[commit: ghc] context-quantification-4426: Improve the error message with -fwarn-context-quantification (a3d98f9)

git at git.haskell.org git at git.haskell.org
Wed Sep 17 21:19:29 UTC 2014


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

On branch  : context-quantification-4426
Link       : http://ghc.haskell.org/trac/ghc/changeset/a3d98f92ae46eedb8be02fb31b745de951148fb3/ghc

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

commit a3d98f92ae46eedb8be02fb31b745de951148fb3
Author: Krzysztof Gogolewski <krz.gogolewski at gmail.com>
Date:   Wed Sep 17 23:19:10 2014 +0200

    Improve the error message with -fwarn-context-quantification


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

a3d98f92ae46eedb8be02fb31b745de951148fb3
 compiler/rename/RnTypes.lhs                        |  4 ++--
 testsuite/tests/rename/should_compile/T4426.stderr | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs
index 5537526..c719191 100644
--- a/compiler/rename/RnTypes.lhs
+++ b/compiler/rename/RnTypes.lhs
@@ -156,7 +156,7 @@ rnHsTyKi isType doc (HsForAllTy Implicit _ lctxt@(L _ ctxt) ty)
 
     rnForAll doc Implicit forall_kvs (mkHsQTvs tyvar_bndrs) lctxt ty
 
-rnHsTyKi isType doc (HsForAllTy Qualified _ lctxt@(L _ ctxt) ty)
+rnHsTyKi isType doc fulltype@(HsForAllTy Qualified _ lctxt@(L _ ctxt) ty)
   = ASSERT( isType ) do
     rdr_env <- getLocalRdrEnv
     loc <- getSrcSpanM
@@ -164,7 +164,7 @@ rnHsTyKi isType doc (HsForAllTy Qualified _ lctxt@(L _ ctxt) ty)
         (forall_kvs, forall_tvs) = filterInScope rdr_env $
                                    extractHsTysRdrTyVars (ty:ctxt)
         tyvar_bndrs = userHsTyVarBndrs loc forall_tvs
-        in_type_doc = ptext (sLit "In the type") <+> quotes (ppr ty)
+        in_type_doc = ptext (sLit "In the type") <+> quotes (ppr fulltype)
 
     -- See Note [Context quantification]
     warnContextQuantification (in_type_doc $$ docOfHsDocContext doc) tyvar_bndrs
diff --git a/testsuite/tests/rename/should_compile/T4426.stderr b/testsuite/tests/rename/should_compile/T4426.stderr
index 3cce305..f4e0c47 100644
--- a/testsuite/tests/rename/should_compile/T4426.stderr
+++ b/testsuite/tests/rename/should_compile/T4426.stderr
@@ -3,33 +3,33 @@ T4426.hs:6:12: Warning:
     Variable ‘m’ is implicitly quantified due to a context
     Use explicit forall syntax instead.
     This will become an error in GHC 7.12.
-    In the type ‘a -> m a’
+    In the type ‘Monad m => a -> m a’
     In the declaration for type synonym ‘F’
 
 T4426.hs:8:15: Warning:
     Variable ‘b’ is implicitly quantified due to a context
     Use explicit forall syntax instead.
     This will become an error in GHC 7.12.
-    In the type ‘a -> b’
+    In the type ‘Eq b => a -> b’
     In the definition of data constructor ‘X’
 
 T4426.hs:10:21: Warning:
     Variable ‘b’ is implicitly quantified due to a context
     Use explicit forall syntax instead.
     This will become an error in GHC 7.12.
-    In the type ‘a -> b -> c’
+    In the type ‘Eq b => a -> b -> c’
     In the definition of data constructor ‘Y’
 
 T4426.hs:10:21: Warning:
     Variable ‘c’ is implicitly quantified due to a context
     Use explicit forall syntax instead.
     This will become an error in GHC 7.12.
-    In the type ‘a -> b -> c’
+    In the type ‘Eq b => a -> b -> c’
     In the definition of data constructor ‘Y’
 
 T4426.hs:12:17: Warning:
     Variable ‘m’ is implicitly quantified due to a context
     Use explicit forall syntax instead.
     This will become an error in GHC 7.12.
-    In the type ‘m b’
+    In the type ‘Monad m => m b’
     In the type signature for ‘f’



More information about the ghc-commits mailing list