[commit: ghc] master: Actually fail in failIfEmitsConstraints (74ed9c1)

git at git.haskell.org git at git.haskell.org
Thu Nov 1 21:43:04 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/74ed9c1c1b26971133c7166663b9c966d2eaca08/ghc

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

commit 74ed9c1c1b26971133c7166663b9c966d2eaca08
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Thu Nov 1 15:37:58 2018 -0400

    Actually fail in failIfEmitsConstraints
    
    The function TcHsType.failIfEmitsConstraints says that it fails.
    It even does so in its name. But it didn't! It *reported* constraints
    but didn't fail. Now it does.
    
    This is important in tcHsClsInstType; see the comments therein.
    
    This was discovered while looking at #15797, but that ticket
    requires visible kind application to exhibit the bug; the test
    case will come with the patch for #12045.


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

74ed9c1c1b26971133c7166663b9c966d2eaca08
 compiler/typecheck/TcHsType.hs                      |  2 +-
 testsuite/tests/polykinds/T11520.stderr             |  6 ------
 testsuite/tests/rename/should_fail/T5951.stderr     |  4 ----
 testsuite/tests/rename/should_fail/rnfail026.stderr |  4 ----
 testsuite/tests/typecheck/should_fail/T11563.stderr |  6 ------
 testsuite/tests/typecheck/should_fail/T13909.stderr |  6 ------
 testsuite/tests/typecheck/should_fail/T2994.stderr  | 13 -------------
 7 files changed, 1 insertion(+), 40 deletions(-)

diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs
index 3706c23..07c3a27 100644
--- a/compiler/typecheck/TcHsType.hs
+++ b/compiler/typecheck/TcHsType.hs
@@ -2871,7 +2871,7 @@ reportFloatingKvs tycon_name flav all_tvs bad_tvs
 failIfEmitsConstraints :: TcM a -> TcM a
 failIfEmitsConstraints thing_inside
   = do { (res, lie) <- captureConstraints thing_inside
-       ; reportAllUnsolved lie
+       ; checkNoErrs $ reportAllUnsolved lie
        ; return res
        }
 
diff --git a/testsuite/tests/polykinds/T11520.stderr b/testsuite/tests/polykinds/T11520.stderr
index 93078aa..11a81ba 100644
--- a/testsuite/tests/polykinds/T11520.stderr
+++ b/testsuite/tests/polykinds/T11520.stderr
@@ -1,10 +1,4 @@
 
-T11520.hs:15:57: error:
-    • Illegal type synonym family application ‘Any’ in instance:
-        Typeable (Compose f g)
-        Use -fprint-explicit-kinds to see the kind arguments
-    • In the instance declaration for ‘Typeable (Compose f g)’
-
 T11520.hs:15:77: error:
     • Expected kind ‘k20 -> k10’, but ‘g’ has kind ‘k’
     • In the second argument of ‘Compose’, namely ‘g’
diff --git a/testsuite/tests/rename/should_fail/T5951.stderr b/testsuite/tests/rename/should_fail/T5951.stderr
index a696997..8fda353 100644
--- a/testsuite/tests/rename/should_fail/T5951.stderr
+++ b/testsuite/tests/rename/should_fail/T5951.stderr
@@ -4,10 +4,6 @@ T5951.hs:8:8: error:
       Expected a constraint, but ‘A’ has kind ‘* -> Constraint’
     • In the instance declaration for ‘B => C’
 
-T5951.hs:8:8: error:
-    • Instance head is not headed by a class: C
-    • In the instance declaration for ‘B => C’
-
 T5951.hs:9:8: error:
     • Expecting one more argument to ‘B’
       Expected a constraint, but ‘B’ has kind ‘* -> Constraint’
diff --git a/testsuite/tests/rename/should_fail/rnfail026.stderr b/testsuite/tests/rename/should_fail/rnfail026.stderr
index 79b07c4..c7ce103 100644
--- a/testsuite/tests/rename/should_fail/rnfail026.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail026.stderr
@@ -1,8 +1,4 @@
 
-rnfail026.hs:16:10: error:
-    • Illegal polymorphic type: forall a. Eq a => Set a
-    • In the instance declaration for ‘Monad (forall a. Eq a => Set a)’
-
 rnfail026.hs:16:27: error:
     • Expected kind ‘* -> *’, but ‘Set a’ has kind ‘*’
     • In the first argument of ‘Monad’, namely
diff --git a/testsuite/tests/typecheck/should_fail/T11563.stderr b/testsuite/tests/typecheck/should_fail/T11563.stderr
index 1283c33..27eca84 100644
--- a/testsuite/tests/typecheck/should_fail/T11563.stderr
+++ b/testsuite/tests/typecheck/should_fail/T11563.stderr
@@ -1,10 +1,4 @@
 
-T11563.hs:5:10: error:
-    • Variable ‘s’ occurs more often
-        in the constraint ‘C s’ than in the instance head ‘C T’
-      (Use UndecidableInstances to permit this)
-    • In the instance declaration for ‘C T’
-
 T11563.hs:5:19: error:
     • Expecting one more argument to ‘T’
       Expected a type, but ‘T’ has kind ‘* -> *’
diff --git a/testsuite/tests/typecheck/should_fail/T13909.stderr b/testsuite/tests/typecheck/should_fail/T13909.stderr
index d70221c..599be5a 100644
--- a/testsuite/tests/typecheck/should_fail/T13909.stderr
+++ b/testsuite/tests/typecheck/should_fail/T13909.stderr
@@ -1,10 +1,4 @@
 
-T13909.hs:11:10: error:
-    • Illegal type synonym family application ‘GHC.Types.Any’ in instance:
-        HasName Hm
-        Use -fprint-explicit-kinds to see the kind arguments
-    • In the instance declaration for ‘HasName Hm’
-
 T13909.hs:11:18: error:
     • Expected kind ‘k0’, but ‘Hm’ has kind ‘forall k -> k -> *’
     • In the first argument of ‘HasName’, namely ‘Hm’
diff --git a/testsuite/tests/typecheck/should_fail/T2994.stderr b/testsuite/tests/typecheck/should_fail/T2994.stderr
index 09b3616..7f20acf 100644
--- a/testsuite/tests/typecheck/should_fail/T2994.stderr
+++ b/testsuite/tests/typecheck/should_fail/T2994.stderr
@@ -5,20 +5,12 @@ T2994.hs:11:10: error:
         but ‘MonadReader Int’ has kind ‘* -> Constraint’
     • In the instance declaration for ‘MonadReader Int’
 
-T2994.hs:11:10: error:
-    • Instance head is not headed by a class: MonadReader Int
-    • In the instance declaration for ‘MonadReader Int’
-
 T2994.hs:13:10: error:
     • Expecting one more argument to ‘MonadReader (Reader' r)’
       Expected a constraint,
         but ‘MonadReader (Reader' r)’ has kind ‘* -> Constraint’
     • In the instance declaration for ‘MonadReader (Reader' r)’
 
-T2994.hs:13:10: error:
-    • Instance head is not headed by a class: MonadReader (Reader' r)
-    • In the instance declaration for ‘MonadReader (Reader' r)’
-
 T2994.hs:13:23: error:
     • Expecting one more argument to ‘Reader' r’
       Expected a type, but ‘Reader' r’ has kind ‘* -> *’
@@ -29,8 +21,3 @@ T2994.hs:15:10: error:
     • Expected kind ‘(* -> *) -> Constraint’,
         but ‘MonadReader r r’ has kind ‘Constraint’
     • In the instance declaration for ‘MonadReader r r (Reader' r)’
-
-T2994.hs:15:10: error:
-    • Instance head is not headed by a class:
-        MonadReader r r (Reader' r)
-    • In the instance declaration for ‘MonadReader r r (Reader' r)’



More information about the ghc-commits mailing list