[commit: ghc] wip/T8584: Use user-supplied type variables (when available) in pattern synonym type signatures (353d11f)
git at git.haskell.org
git at git.haskell.org
Wed Nov 12 12:06:00 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T8584
Link : http://ghc.haskell.org/trac/ghc/changeset/353d11fca8e52eae31b1f48832ae8db2db35eec1/ghc
>---------------------------------------------------------------
commit 353d11fca8e52eae31b1f48832ae8db2db35eec1
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date: Sun Nov 9 15:46:46 2014 +0800
Use user-supplied type variables (when available) in pattern synonym type signatures
>---------------------------------------------------------------
353d11fca8e52eae31b1f48832ae8db2db35eec1
compiler/rename/RnBinds.lhs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index b43993e..80239e9 100644
--- a/compiler/rename/RnBinds.lhs
+++ b/compiler/rename/RnBinds.lhs
@@ -846,8 +846,16 @@ renameSig ctxt sig@(PatSynSig v (flag, qtvs) prov req ty)
; let doc = TypeSigCtx $ quotes (ppr v)
; loc <- getSrcSpanM
- ; let (tv_kvs, tvs) = extractHsTysRdrTyVars (ty:unLoc prov ++ unLoc req)
- ; let tv_bndrs = mkHsQTvs . userHsTyVarBndrs loc $ tvs
+ ; let (tv_kvs, mentioned) = extractHsTysRdrTyVars (ty:unLoc prov ++ unLoc req)
+ ; tv_bndrs <- case flag of
+ Implicit ->
+ return $ mkHsQTvs . userHsTyVarBndrs loc $ mentioned
+ Explicit ->
+ do { let heading = ptext (sLit "In the pattern synonym type signature")
+ <+> quotes (ppr sig)
+ ; warnUnusedForAlls (heading $$ docOfHsDocContext doc) qtvs mentioned
+ ; return qtvs }
+ Qualified -> panic "renameSig: Qualified"
; bindHsTyVars doc Nothing tv_kvs tv_bndrs $ \ tyvars -> do
{ (prov', fvs1) <- rnContext doc prov
More information about the ghc-commits
mailing list