[commit: ghc] master: Localize API Annotation in LInjectivtyAnn (7966eea)
git at git.haskell.org
git at git.haskell.org
Tue Dec 22 16:12:51 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/7966eea9814bfab437e6c9ce210459e1dd936630/ghc
>---------------------------------------------------------------
commit 7966eea9814bfab437e6c9ce210459e1dd936630
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date: Tue Dec 22 15:12:41 2015 +0200
Localize API Annotation in LInjectivtyAnn
The injectivity_cond production in Parser.y returns the annotation for
the '->' to the calling production, rather than applying it directly.
Rather apply it directly, so LInjectivityAnn can be rendered as a unit
from the API Annotations.
>---------------------------------------------------------------
7966eea9814bfab437e6c9ce210459e1dd936630
compiler/parser/Parser.y | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index be36b4e..777bae0 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -940,13 +940,13 @@ overlap_pragma :: { Maybe (Located OverlapMode) }
opt_injective_info :: { Located ([AddAnn], Maybe (LInjectivityAnn RdrName)) }
: {- empty -} { noLoc ([], Nothing) }
- | '|' injectivity_cond { sLL $1 $> ( mj AnnVbar $1 : fst (unLoc $2)
- , Just (snd (unLoc $2))) }
+ | '|' injectivity_cond { sLL $1 $> ([mj AnnVbar $1]
+ , Just ($2)) }
-injectivity_cond :: { Located ([AddAnn], LInjectivityAnn RdrName) }
+injectivity_cond :: { LInjectivityAnn RdrName }
: tyvarid '->' inj_varids
- { sLL $1 $> ( [mu AnnRarrow $2]
- , (sLL $1 $> (InjectivityAnn $1 (reverse (unLoc $3))))) }
+ {% ams (sLL $1 $> (InjectivityAnn $1 (reverse (unLoc $3))))
+ [mu AnnRarrow $2] }
inj_varids :: { Located [Located RdrName] }
: inj_varids tyvarid { sLL $1 $> ($2 : unLoc $1) }
@@ -1084,8 +1084,8 @@ opt_at_kind_inj_sig :: { Located ([AddAnn], ( LFamilyResultSig RdrName
| '::' kind { sLL $1 $> ( [mu AnnDcolon $1]
, (sLL $2 $> (KindSig $2), Nothing)) }
| '=' tv_bndr '|' injectivity_cond
- { sLL $1 $> ( mj AnnEqual $1 : mj AnnVbar $3 : fst (unLoc $4)
- , (sLL $1 $2 (TyVarSig $2), Just (snd (unLoc $4))))}
+ { sLL $1 $> ([mj AnnEqual $1, mj AnnVbar $3]
+ , (sLL $1 $2 (TyVarSig $2), Just $4))}
-- tycl_hdr parses the header of a class or data type decl,
-- which takes the form
More information about the ghc-commits
mailing list