summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-06-19 21:44:17 +0200
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2021-06-23 23:16:37 +0200
commit09be2b2b3cd1aaccdc7afa5a69d39d8b2fc0a6f0 (patch)
tree1a7664324e0ded59d755d2518a532ff69398fb18 /compiler/GHC/Tc
parent633bbc1fd4762a2bb73ba1c5b9e0c279f1dd3c40 (diff)
downloadhaskell-wip/runtime-error-fixes.tar.gz
Fixes around incomplete guards (#20023, #20024)wip/runtime-error-fixes
- Fix linearity error with incomplete MultiWayIf (#20023) - Fix partial pattern binding error message (#20024) - Remove obsolete test LinearPolyTest It tested the special typing rule for ($), which was removed during the implementation of Quick Look 97cff9190d3. - Fix ticket numbers in linear/*/all.T, they referred to linear types issue tracker
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r--compiler/GHC/Tc/Errors.hs4
-rw-r--r--compiler/GHC/Tc/Types/EvTerm.hs15
2 files changed, 6 insertions, 13 deletions
diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs
index f3c8a19b04..e45d051e50 100644
--- a/compiler/GHC/Tc/Errors.hs
+++ b/compiler/GHC/Tc/Errors.hs
@@ -953,10 +953,10 @@ mkErrorTerm ctxt ct_loc ty report
-- This will be reported at runtime, so we always want "error:" in the report, never "warning:"
; dflags <- getDynFlags
; let err_msg = pprLocMsgEnvelope msg
- err_fs = mkFastString $ showSDoc dflags $
+ err_str = showSDoc dflags $
err_msg $$ text "(deferred type error)"
- ; return $ evDelayedError ty err_fs }
+ ; return $ evDelayedError ty err_str }
tryReporters :: ReportErrCtxt -> [ReporterSpec] -> [Ct] -> TcM (ReportErrCtxt, [Ct])
-- Use the first reporter in the list whose predicate says True
diff --git a/compiler/GHC/Tc/Types/EvTerm.hs b/compiler/GHC/Tc/Types/EvTerm.hs
index 19afec031a..ad380ec0a2 100644
--- a/compiler/GHC/Tc/Types/EvTerm.hs
+++ b/compiler/GHC/Tc/Types/EvTerm.hs
@@ -13,34 +13,27 @@ import GHC.Tc.Types.Evidence
import GHC.Unit
import GHC.Builtin.Names
-import GHC.Builtin.Types ( liftedRepTy, unitTy )
+import GHC.Builtin.Types ( unitTy )
import GHC.Core.Type
import GHC.Core
import GHC.Core.Make
import GHC.Core.Utils
-import GHC.Types.Literal ( Literal(..) )
import GHC.Types.SrcLoc
import GHC.Types.Name
import GHC.Types.TyThing
-import GHC.Data.FastString
-
-- Used with Opt_DeferTypeErrors
-- See Note [Deferring coercion errors to runtime]
-- in GHC.Tc.Solver
-evDelayedError :: Type -> FastString -> EvTerm
+evDelayedError :: Type -> String -> EvTerm
evDelayedError ty msg
= EvExpr $
- let fail_expr = Var errorId `mkTyApps` [liftedRepTy, unitTy] `mkApps` [litMsg]
+ let fail_expr = mkRuntimeErrorApp tYPE_ERROR_ID unitTy msg
in mkWildCase fail_expr (unrestricted unitTy) ty []
-- See Note [Incompleteness and linearity] in GHC.HsToCore.Utils
- -- c.f. mkFailExpr in GHC.HsToCore.Utils
-
- where
- errorId = tYPE_ERROR_ID
- litMsg = Lit (LitString (bytesFS msg))
+ -- c.f. mkErrorAppDs in GHC.HsToCore.Utils
-- Dictionary for CallStack implicit parameters
evCallStack :: (MonadThings m, HasModule m, HasDynFlags m) =>