summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-02-15 08:46:36 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2016-02-15 08:47:31 +0000
commitbb7f23084e2a886f5b48442458d33b43c4628b3c (patch)
tree41311ad7b6045111e5cc8a9a736585a8db2c6ffa /compiler
parent18cd712427182e76d38047860ee3e26799bc3fe2 (diff)
downloadhaskell-bb7f23084e2a886f5b48442458d33b43c4628b3c.tar.gz
Comments only
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcErrors.hs17
-rw-r--r--compiler/typecheck/TcSimplify.hs8
2 files changed, 19 insertions, 6 deletions
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 5f2c908849..e97e3c566e 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 8cc9b4939b..be0735816b 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"