diff options
author | Paul Phillips <paulp@improving.org> | 2011-05-06 04:32:39 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-05-06 04:32:39 +0000 |
commit | 311b7de861bd2f4137e3503483177a1588cfdd12 (patch) | |
tree | 7b784b842cdf4a791a056e045eb4aa208c1e755a /test/files/neg/patmatexhaust.scala | |
parent | 14cd653295b5ed3f10b82193a9fb6da0867e31d6 (diff) | |
download | scala-311b7de861bd2f4137e3503483177a1588cfdd12.tar.gz scala-311b7de861bd2f4137e3503483177a1588cfdd12.tar.bz2 scala-311b7de861bd2f4137e3503483177a1588cfdd12.zip |
Finally figured out what was going on with a ce...
Finally figured out what was going on with a certain class of
exhaustiveness checking bugs. Hey moors, you can put away your pins,
puppets, and magic sauces. Closes #3098, no review.
Diffstat (limited to 'test/files/neg/patmatexhaust.scala')
-rw-r--r-- | test/files/neg/patmatexhaust.scala | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/test/files/neg/patmatexhaust.scala b/test/files/neg/patmatexhaust.scala index d49c4b207b..45aed558da 100644 --- a/test/files/neg/patmatexhaust.scala +++ b/test/files/neg/patmatexhaust.scala @@ -76,14 +76,56 @@ class TestSealedExhaustive { // compile only case B1() => true // missing B, which is not abstract so must be included case B2 => true } - sealed abstract class C - abstract class C1 extends C - object C2 extends C - case object C6 extends C - class C3 extends C1 - case class C4() extends C3 - def ma10(x: C) = x match { // exhaustive - case C4() => true - case C2 | C6 => true + + object ob1 { + sealed abstract class C + sealed abstract class C1 extends C + object C2 extends C + case class C3() extends C + case object C4 extends C + + def ma10(x: C) = x match { // exhaustive: abstract sealed C1 is dead end. + case C3() => true + case C2 | C4 => true + } + } + + object ob2 { + sealed abstract class C + abstract class C1 extends C + object C2 extends C + case class C3() extends C + case object C4 extends C + + def ma10(x: C) = x match { // not exhaustive: C1 is not sealed. + case C3() => true + case C2 | C4 => true + } + } + object ob3 { + sealed abstract class C + sealed abstract class C1 extends C + object D1 extends C1 + case class D2() extends C1 + object C2 extends C + case class C3() extends C + case object C4 extends C + + def ma10(x: C) = x match { // not exhaustive: C1 has subclasses. + case C3() => true + case C2 | C4 => true + } + } + object ob4 { + sealed abstract class C + sealed class C1 extends C + object C2 extends C + case class C3() extends C + case object C4 extends C + + def ma10(x: C) = x match { // not exhaustive: C1 is not abstract. + case C3() => true + case C2 | C4 => true + } } } |