[commit: ghc] wip/T8584: Use user-supplied type variables (when available) in pattern synonym type signatures (282fb3a)

git at git.haskell.org git at git.haskell.org
Tue Nov 11 13:05:57 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T8584
Link       : http://ghc.haskell.org/trac/ghc/changeset/282fb3a985c9ee76f562a733d401c90446576b34/ghc

>---------------------------------------------------------------

commit 282fb3a985c9ee76f562a733d401c90446576b34
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


>---------------------------------------------------------------

282fb3a985c9ee76f562a733d401c90446576b34
 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