diff options
author | simonpj@microsoft.com <unknown> | 2009-04-02 15:28:34 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2009-04-02 15:28:34 +0000 |
commit | 9414bda057e8ac8422ca5590c8500c7cdee323bb (patch) | |
tree | ad61c9dae849cd3bb3032785a60acdcce5da1e8a /compiler/specialise | |
parent | a11662957fa688997e6c4befff44e7efe94c2db8 (diff) | |
download | haskell-9414bda057e8ac8422ca5590c8500c7cdee323bb.tar.gz |
Fix Trac #3118: missing alternative
This patch fixes a rather obscure bug, whereby it's possible
for (case C a b of <alts>) to have altenatives that do not inclue
(C a b)! See Note [Unreachable code] in CoreUtils.
Diffstat (limited to 'compiler/specialise')
-rw-r--r-- | compiler/specialise/SpecConstr.lhs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/specialise/SpecConstr.lhs b/compiler/specialise/SpecConstr.lhs index 3dfda94ca3..3a4b382910 100644 --- a/compiler/specialise/SpecConstr.lhs +++ b/compiler/specialise/SpecConstr.lhs @@ -27,6 +27,7 @@ import Coercion import Rules import Type hiding( substTy ) import Id +import MkId ( mkImpossibleExpr ) import Var import VarEnv import VarSet @@ -778,7 +779,8 @@ scExpr' env (Case scrut b ty alts) where sc_con_app con args scrut' -- Known constructor; simplify = do { let (_, bs, rhs) = findAlt con alts - alt_env' = extendScSubstList env ((b,scrut') : bs `zip` trimConArgs con args) + `orElse` (DEFAULT, [], mkImpossibleExpr (coreAltsType alts)) + alt_env' = extendScSubstList env ((b,scrut') : bs `zip` trimConArgs con args) ; scExpr alt_env' rhs } sc_vanilla scrut_usg scrut' -- Normal case |