[commit: ghc] master: Comments only (bb7f230)

git at git.haskell.org git at git.haskell.org
Mon Feb 15 08:45:52 UTC 2016


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

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

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

commit bb7f23084e2a886f5b48442458d33b43c4628b3c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Feb 15 08:46:36 2016 +0000

    Comments only


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

bb7f23084e2a886f5b48442458d33b43c4628b3c
 compiler/typecheck/TcErrors.hs                      | 17 +++++++++++++----
 compiler/typecheck/TcSimplify.hs                    |  8 ++++++--
 testsuite/tests/typecheck/should_fail/T11541.hs     |  8 ++++++++
 testsuite/tests/typecheck/should_fail/T11541.stderr |  2 ++
 testsuite/tests/typecheck/should_fail/all.T         |  1 +
 5 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 5f2c908..e97e3c5 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -134,7 +134,12 @@ reportUnsolved wanted
        ; getTcEvBinds binds_var }
 
 -- | Report *all* unsolved goals as errors, even if -fdefer-type-errors is on
+-- However, do not make any evidence bindings, because we don't
+-- have any convenient place to put them.
 -- See Note [Deferring coercion errors to runtime]
+-- Used by solveEqualities for kind equalities
+--      (see Note [Fail fast on kind errors] in TcSimplify]
+-- and for simplifyDefault.
 reportAllUnsolved :: WantedConstraints -> TcM ()
 reportAllUnsolved wanted
   = report_unsolved Nothing False TypeError HoleError HoleError wanted
@@ -240,11 +245,15 @@ data ReportErrCtxt
                                        --   (innermost first)
                                        -- ic_skols and givens are tidied, rest are not
           , cec_tidy  :: TidyEnv
+
           , cec_binds :: Maybe EvBindsVar
-                         -- Nothinng <=> Report all errors, including holes; no bindings
-                         -- Just ev  <=> make some errors (depending on cec_defer)
-                         --              into warnings, and emit evidence bindings
-                         --              into 'ev' for unsolved constraints
+                         -- Nothing <=> Report all errors, including holes
+                         --             Do not add any evidence bindings, because
+                         --             we have no convenient place to put them
+                         --             See TcErrors.reportAllUnsolved
+                         -- Just ev <=> make some errors (depending on cec_defer)
+                         --             into warnings, and emit evidence bindings
+                         --             into 'ev' for unsolved constraints
 
           , cec_errors_as_warns :: Bool   -- Turn all errors into warnings
                                           -- (except for Holes, which are
diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs
index 8cc9b49..be07358 100644
--- a/compiler/typecheck/TcSimplify.hs
+++ b/compiler/typecheck/TcSimplify.hs
@@ -188,11 +188,15 @@ defaultCallStacks wanteds
 solveEqualities is used to solve kind equalities when kind-checking
 user-written types. If solving fails we should fail outright, rather
 than just accumulate an error message, for two reasons:
+
   * A kind-bogus type signature may cause a cascade of knock-on
     errors if we let it pass
 
-  * More seriously, if we don't solve a constraint we'll be left
-    with a type that has a coercion hole in it, something like
+  * More seriously, we don't have a convenient term-level place to add
+    deferred bindings for unsolved kind-equality constraints, so we
+    don't build evidence bindings (by usine reportAllUnsolved). That
+    means that we'll be left with with a type that has coercion holes
+    in it, something like
            <type> |> co-hole
     where co-hole is not filled in.  Eeek!  That un-filled-in
     hole actually causes GHC to crash with "fvProv falls into a hole"
diff --git a/testsuite/tests/typecheck/should_fail/T11541.hs b/testsuite/tests/typecheck/should_fail/T11541.hs
new file mode 100644
index 0000000..56f41f3
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T11541.hs
@@ -0,0 +1,8 @@
+module T11541 where
+
+g :: Ord k => k -> v -> ()
+g k v = ()
+
+f x y =
+   let m = min x y
+   in  g m foo
diff --git a/testsuite/tests/typecheck/should_fail/T11541.stderr b/testsuite/tests/typecheck/should_fail/T11541.stderr
new file mode 100644
index 0000000..5669c9c
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T11541.stderr
@@ -0,0 +1,2 @@
+
+T11541.hs:8:12: error: Variable not in scope: foo
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index bf8d7c7..69df866 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -406,3 +406,4 @@ test('T11355', normal, compile_fail, [''])
 test('T11464', normal, compile_fail, [''])
 test('T11473', expect_broken(11473), compile_fail, [''])
 test('T11563', normal, compile_fail, [''])
+test('T11541', normal, compile_fail, [''])



More information about the ghc-commits mailing list