diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-02-26 14:51:59 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-05 04:48:39 -0500 |
commit | 4cd98bd2c91cac4a10831ab7111c7be8153bdd33 (patch) | |
tree | ab3fc0a338e56e9fe901332fbb957abf7a2eefce /compiler/GHC/Tc/Types | |
parent | 6467a48e64ce5ccea29099cb89962e879cded91c (diff) | |
download | haskell-4cd98bd2c91cac4a10831ab7111c7be8153bdd33.tar.gz |
Run linear Lint on the desugarer output (part of #19165)
This addresses points (1a) and (1b) of #19165.
- Move mkFailExpr to HsToCore/Utils, as it can be shared
- Desugar incomplete patterns and holes to an empty case,
as in Note [Incompleteness and linearity]
- Enable linear linting of desugarer output
- Mark MultConstructor as broken. It fails Lint, but I'd like to fix this
separately.
Metric Decrease:
T6048
Diffstat (limited to 'compiler/GHC/Tc/Types')
-rw-r--r-- | compiler/GHC/Tc/Types/EvTerm.hs | 7 |
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)) |