diff options
Diffstat (limited to 'compiler/GHC/Parser.y')
-rw-r--r-- | compiler/GHC/Parser.y | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index 16eff90656..b8a777a8fe 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -2055,12 +2055,14 @@ type :: { LHsType GhcPs } >> ams (sLL $1 $> $ HsFunTy noExtField HsUnrestrictedArrow $1 $3) [mu AnnRarrow $2] } - | btype mult '->' ctype {% hintLinear (getLoc $2) >> - ams (sLL $1 $> $ HsFunTy noExtField (unLoc $2) $1 $4) + | btype mult '->' ctype {% hintLinear (getLoc $2) + >> ams $1 [mu AnnRarrow $3] -- See note [GADT decl discards annotations] + >> ams (sLL $1 $> $ HsFunTy noExtField (unLoc $2) $1 $4) [mu AnnRarrow $3] } - | btype '->.' ctype {% hintLinear (getLoc $2) >> - ams (sLL $1 $> $ HsFunTy noExtField HsLinearArrow $1 $3) + | btype '->.' ctype {% hintLinear (getLoc $2) + >> ams $1 [mu AnnLollyU $2] -- See note [GADT decl discards annotations] + >> ams (sLL $1 $> $ HsFunTy noExtField HsLinearArrow $1 $3) [mu AnnLollyU $2] } mult :: { Located (HsArrow GhcPs) } @@ -2285,9 +2287,9 @@ gadt_constr :: { LConDecl GhcPs } -- see Note [Difference in parsing GADT and data constructors] -- Returns a list because of: C,D :: ty : optSemi con_list '::' sigtype - {% do { decl <- mkGadtDecl (unLoc $2) $4 + {% do { (decl, anns) <- mkGadtDecl (unLoc $2) $4 ; ams (sLL $2 $> decl) - [mu AnnDcolon $3] } } + (mu AnnDcolon $3:anns) } } {- Note [Difference in parsing GADT and data constructors] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |