summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2018-06-24 22:00:22 +0200
committerAlan Zimmerman <alan.zimm@gmail.com>2018-06-24 22:42:17 +0200
commit5db9f9129e7519db0c9841fbe7c14f350c23284c (patch)
treead9b970ad91c3f03e671d1f94f6b1a1791339971 /compiler/parser
parent33724fc75499a3dfaf2ffcc4bf5db6d505df58f4 (diff)
downloadhaskell-5db9f9129e7519db0c9841fbe7c14f350c23284c.tar.gz
Tweak API Annotations for ConDeclGADT
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Parser.y3
-rw-r--r--compiler/parser/RdrHsSyn.hs11
2 files changed, 7 insertions, 7 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 0e93dd043b..6b0317bd9c 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1882,7 +1882,8 @@ is connected to the first type too.
type :: { LHsType GhcPs }
: btype { $1 }
- | btype '->' ctype {% ams (sLL $1 $> $ HsFunTy noExt $1 $3)
+ | btype '->' ctype {% ams $1 [mu AnnRarrow $2] -- See note [GADT decl discards annotations]
+ >> ams (sLL $1 $> $ HsFunTy noExt $1 $3)
[mu AnnRarrow $2] }
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs
index 22de5ac63f..44159dc35d 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -649,7 +649,7 @@ mkGadtDecl names ty
, con_args = args'
, con_res_ty = res_ty
, con_doc = Nothing }
- , anns1 ++ anns2 ++ anns3)
+ , anns1 ++ anns2)
where
(ty'@(L l _),anns1) = peel_parens ty []
(tvs, rho) = splitLHsForAllTy ty'
@@ -660,14 +660,13 @@ mkGadtDecl names ty
split_rho (L l (HsParTy _ ty)) ann = split_rho ty (ann++mkParensApiAnn l)
split_rho tau ann = (Nothing, tau, ann)
- (args, res_ty, anns3) = split_tau tau []
+ (args, res_ty) = split_tau tau
args' = nudgeHsSrcBangs args
-- See Note [GADT abstract syntax] in HsDecls
- split_tau (L _ (HsFunTy _ (L loc (HsRecTy _ rf)) res_ty)) ann
- = (RecCon (L loc rf), res_ty, ann)
- split_tau (L l (HsParTy _ ty)) ann = split_tau ty (ann++mkParensApiAnn l)
- split_tau tau ann = (PrefixCon [], tau, ann)
+ split_tau (L _ (HsFunTy _ (L loc (HsRecTy _ rf)) res_ty))
+ = (RecCon (L loc rf), res_ty)
+ split_tau tau = (PrefixCon [], tau)
peel_parens (L l (HsParTy _ ty)) ann = peel_parens ty
(ann++mkParensApiAnn l)