Opened 3 years ago

Closed 3 years ago

#10314 closed bug (invalid)

ApiAnnotations: mkHsForAllTy discards parens

Reported by: alanz Owned by: alanz
Priority: normal Milestone: 7.10.2
Component: Compiler Version: 7.10.1
Keywords: ApiAnnotations Cc: mpickering
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The code for HsForAllTy is

mkHsForAllTy exp tvs ctxt     ty = HsForAllTy exp extra (mkHsQTvs tvs) cleanCtxt ty
  where -- Separate the extra-constraints wildcard when present
        (cleanCtxt, extra)
          | (L l HsWildcardTy) <- ignoreParens (last (unLoc ctxt)) = (init `fmap` ctxt, Just l)
          | otherwise = (ctxt, Nothing)
        ignoreParens (L _ (HsParTy ty)) = ty
        ignoreParens ty                 = ty

The process of cleaning the context calls ignoreParens which strips out the HsParTy. In the process the AnnOpenP and AnnCloseP attached to this are discarded.

Change History (3)

comment:1 Changed 3 years ago by alanz

This process may also be taking place for


comment:2 Changed 3 years ago by alanz

The mkHsForAllTy case is safe, as ignoreParens is only used in the conditional part.


mk_forall_ty exp  tvs  (L _ (HsParTy ty)) = mk_forall_ty exp tvs ty

does strip parens.

comment:3 Changed 3 years ago by alanz

Resolution: invalid
Status: newclosed

Nope, these cases are all handled already.

Note: See TracTickets for help on using tickets.