Commit 5db9f912 authored by Alan Zimmerman's avatar Alan Zimmerman

Tweak API Annotations for ConDeclGADT

parent 33724fc7
......@@ -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] }
......
......@@ -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)
......
......@@ -16,6 +16,7 @@
((Test10255.hs:6:6-26,AnnDcolon), [Test10255.hs:6:8-9]),
((Test10255.hs:6:11-26,AnnCloseP), [Test10255.hs:6:26]),
((Test10255.hs:6:11-26,AnnOpenP), [Test10255.hs:6:11]),
((Test10255.hs:6:12-18,AnnRarrow), [Test10255.hs:6:20-21]),
((Test10255.hs:6:12-25,AnnRarrow), [Test10255.hs:6:20-21]),
((<no location info>,AnnEofPos), [Test10255.hs:8:1])
]
......
......@@ -33,6 +33,7 @@
((Test10278.hs:(8,20)-(10,57),AnnForall), [Test10278.hs:8:20-25]),
((Test10278.hs:(8,32)-(10,57),AnnDot), [Test10278.hs:8:43]),
((Test10278.hs:(8,32)-(10,57),AnnForall), [Test10278.hs:8:32-37]),
((Test10278.hs:9:27-50,AnnRarrow), [Test10278.hs:10:31-32]),
((Test10278.hs:(9,27)-(10,57),AnnRarrow), [Test10278.hs:10:31-32]),
((Test10278.hs:9:38-50,AnnCloseP), [Test10278.hs:9:50]),
((Test10278.hs:9:38-50,AnnOpenP), [Test10278.hs:9:38]),
......
......@@ -171,6 +171,7 @@
((Test10312.hs:68:28-35,AnnOpenP), [Test10312.hs:68:28]),
((Test10312.hs:68:28-35,AnnRarrow), [Test10312.hs:68:37-38]),
((Test10312.hs:68:28-51,AnnRarrow), [Test10312.hs:68:37-38]),
((Test10312.hs:68:29,AnnRarrow), [Test10312.hs:68:31-32]),
((Test10312.hs:68:29-34,AnnRarrow), [Test10312.hs:68:31-32]),
((Test10312.hs:68:40-42,AnnCloseS), [Test10312.hs:68:42]),
((Test10312.hs:68:40-42,AnnOpenS), [Test10312.hs:68:40]),
......
......@@ -55,8 +55,11 @@
((Test10399.hs:16:28-43,AnnDarrow), [Test10399.hs:16:45-46]),
((Test10399.hs:16:28-43,AnnOpenP), [Test10399.hs:16:28, Test10399.hs:16:28]),
((Test10399.hs:16:30-33,AnnComma), [Test10399.hs:16:34]),
((Test10399.hs:16:48,AnnRarrow), [Test10399.hs:16:50-51]),
((Test10399.hs:(16,48)-(17,68),AnnRarrow), [Test10399.hs:16:50-51]),
((Test10399.hs:16:53-66,AnnRarrow), [Test10399.hs:17:45-46]),
((Test10399.hs:(16,53)-(17,68),AnnRarrow), [Test10399.hs:17:45-46]),
((Test10399.hs:17:48,AnnRarrow), [Test10399.hs:17:50-51]),
((Test10399.hs:17:48-68,AnnRarrow), [Test10399.hs:17:50-51]),
((Test10399.hs:17:66-68,AnnCloseS), [Test10399.hs:17:68]),
((Test10399.hs:17:66-68,AnnOpenS), [Test10399.hs:17:66]),
......@@ -69,6 +72,7 @@
((Test10399.hs:18:20-54,AnnForall), [Test10399.hs:18:20-25]),
((Test10399.hs:18:31-36,AnnCloseP), [Test10399.hs:18:36]),
((Test10399.hs:18:31-36,AnnOpenP), [Test10399.hs:18:31]),
((Test10399.hs:18:31-36,AnnRarrow), [Test10399.hs:18:38-39]),
((Test10399.hs:18:31-54,AnnRarrow), [Test10399.hs:18:38-39]),
((Test10399.hs:20:1-25,AnnCloseQ), [Test10399.hs:20:24-25]),
((Test10399.hs:20:1-25,AnnOpen), [Test10399.hs:20:1-3]),
......
......@@ -24,6 +24,7 @@
((Test11018.hs:12:21-32,AnnCloseP), [Test11018.hs:12:32]),
((Test11018.hs:12:21-32,AnnDcolonU), [Test11018.hs:12:24]),
((Test11018.hs:12:21-32,AnnOpenP), [Test11018.hs:12:21]),
((Test11018.hs:12:26,AnnRarrow), [Test11018.hs:12:28-29]),
((Test11018.hs:12:26-31,AnnRarrow), [Test11018.hs:12:28-29]),
((Test11018.hs:(13,16)-(15,7),AnnCloseC), [Test11018.hs:15:7]),
((Test11018.hs:(13,16)-(15,7),AnnOpenC), [Test11018.hs:13:16]),
......@@ -121,6 +122,7 @@
((Test11018.hs:37:22-32,AnnCloseP), [Test11018.hs:37:32]),
((Test11018.hs:37:22-32,AnnDcolonU), [Test11018.hs:37:25]),
((Test11018.hs:37:22-32,AnnOpenP), [Test11018.hs:37:22]),
((Test11018.hs:37:27,AnnRarrowU), [Test11018.hs:37:29]),
((Test11018.hs:37:27-31,AnnRarrowU), [Test11018.hs:37:29]),
((Test11018.hs:(38,17)-(40,7),AnnCloseC), [Test11018.hs:40:7]),
((Test11018.hs:(38,17)-(40,7),AnnOpenC), [Test11018.hs:38:17]),
......
......@@ -64,6 +64,7 @@
((AnnotationTuple.hs:18:1-28,AnnDcolon), [AnnotationTuple.hs:18:20-21]),
((AnnotationTuple.hs:18:1-28,AnnFamily), [AnnotationTuple.hs:18:6-11]),
((AnnotationTuple.hs:18:1-28,AnnSemi), [AnnotationTuple.hs:19:1]),
((AnnotationTuple.hs:18:23,AnnRarrow), [AnnotationTuple.hs:18:25-26]),
((AnnotationTuple.hs:18:23-28,AnnRarrow), [AnnotationTuple.hs:18:25-26]),
((AnnotationTuple.hs:(20,1)-(24,14),AnnFunId), [AnnotationTuple.hs:20:1-5]),
((AnnotationTuple.hs:(20,1)-(24,14),AnnSemi), [AnnotationTuple.hs:25:1]),
......
......@@ -130,6 +130,8 @@
(AK AnnotationTuple.hs:18:1-28 AnnSemi = [AnnotationTuple.hs:19:1])
(AK AnnotationTuple.hs:18:23 AnnRarrow = [AnnotationTuple.hs:18:25-26])
(AK AnnotationTuple.hs:18:23-28 AnnRarrow = [AnnotationTuple.hs:18:25-26])
(AK AnnotationTuple.hs:(20,1)-(24,14) AnnFunId = [AnnotationTuple.hs:20:1-5])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment