summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2015-05-11 10:57:25 +0200
committerAlan Zimmerman <alan.zimm@gmail.com>2015-05-11 10:57:25 +0200
commite4032b1951a35d8df63a74ebfee7449988b5ef40 (patch)
treec1e51275ba5a23411de3ea6248e620262bbfc2af /compiler/parser
parent811b72adedcd12149783eac19ebccff1dd72bc1c (diff)
downloadhaskell-e4032b1951a35d8df63a74ebfee7449988b5ef40.tar.gz
ApiAnnotations : mkGadtDecl discards annotations for HsFunTy
Summary: When mkGadtDecl is presented wih a HsFunTy it discards the SrcSpan, thus disconnecting any annotations on the HsFunTy. ``` mkGadtDecl names (L ls (HsForAllTy imp Nothing qvars cxt tau)) = return $ mk_gadt_con names where (details, res_ty) -- See Note [Sorting out the result type] = case tau of L _ (HsFunTy (L l (HsRecTy flds)) res_ty) -> (RecCon (L l flds), res_ty) _other -> (PrefixCon [], tau) ... ``` This can be triggered by the following ``` {-# LANGUAGE GADTs #-} module GADTRecords2 (H1(..)) where -- | h1 data H1 a b where C3 :: (Num a) => { field :: a -- ^ hello docs } -> H1 Int Int ``` Test Plan: ./validate Reviewers: hvr, austin Reviewed By: austin Subscribers: bgamari, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D848 GHC Trac Issues: #10309
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Parser.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 1baf606173..3d9b2a39cb 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1621,7 +1621,8 @@ type :: { LHsType RdrName }
: btype { $1 }
| btype qtyconop type { sLL $1 $> $ mkHsOpTy $1 $2 $3 }
| btype tyvarop type { sLL $1 $> $ mkHsOpTy $1 $2 $3 }
- | btype '->' ctype {% ams (sLL $1 $> $ HsFunTy $1 $3)
+ | btype '->' ctype {% ams $1 [mj AnnRarrow $2]
+ >> ams (sLL $1 $> $ HsFunTy $1 $3)
[mj AnnRarrow $2] }
| btype '~' btype {% ams (sLL $1 $> $ HsEqTy $1 $3)
[mj AnnTilde $2] }