summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Types/EvTerm.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc/Types/EvTerm.hs')
-rw-r--r--compiler/GHC/Tc/Types/EvTerm.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/Types/EvTerm.hs b/compiler/GHC/Tc/Types/EvTerm.hs
index d1a0f56531..19afec031a 100644
--- a/compiler/GHC/Tc/Types/EvTerm.hs
+++ b/compiler/GHC/Tc/Types/EvTerm.hs
@@ -13,6 +13,7 @@ import GHC.Tc.Types.Evidence
import GHC.Unit
import GHC.Builtin.Names
+import GHC.Builtin.Types ( liftedRepTy, unitTy )
import GHC.Core.Type
import GHC.Core
@@ -32,7 +33,11 @@ import GHC.Data.FastString
evDelayedError :: Type -> FastString -> EvTerm
evDelayedError ty msg
= EvExpr $
- Var errorId `mkTyApps` [getRuntimeRep ty, ty] `mkApps` [litMsg]
+ let fail_expr = Var errorId `mkTyApps` [liftedRepTy, unitTy] `mkApps` [litMsg]
+ 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))