diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-06-18 08:51:08 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-06-18 08:51:08 +0100 |
commit | 023a0ba938b69bbb89cb2ce48a07459b07783391 (patch) | |
tree | 40e15e16fa74027bd870086635919639313733bb /testsuite/tests/generics/GenShouldFail1_0.hs | |
parent | b98ca17e12c7efdc906f4901f25e6263a5399be1 (diff) | |
download | haskell-023a0ba938b69bbb89cb2ce48a07459b07783391.tar.gz |
Care with impossible-cons in combineIdenticalAlts
This was a nasty, long-standing bug exposed in Trac #10538.
Symptoms were that we had an empty case
case (x :: Either a) of {}
Core Lint correctly picked this bogus code up.
Here is what happened
* In SimplUtils.prepareAlts, we call
filterAlts
then
combineIdenticalAlts
* We had case x of { Left _ -> e1; Right _ -> e1 }
* filterAlts did nothing, but correctly retuned imposs_deflt_cons
saying that 'x' cannot be {Left, Right} in the DEFAULT branch,
if any (there isn't one.)
* combineIdentialAlts correctly combines the identical alts, to give
case x of { DEFAULT -> e1 }
* BUT combineIdenticalAlts did no adjust imposs_deft_cons
* Result: when compiling e1 we did so in the belief that 'x'
could not be {Left,Right}. Disaster.
Easily fixed.
(It is hard to trigger; I can't construct a simple test case.)
Diffstat (limited to 'testsuite/tests/generics/GenShouldFail1_0.hs')
0 files changed, 0 insertions, 0 deletions