summaryrefslogtreecommitdiff
path: root/test/files/neg/patmatexhaust.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-10-17 12:36:14 +0000
committerPaul Phillips <paulp@improving.org>2009-10-17 12:36:14 +0000
commit4cb4ad76b213389b828ae9c1ab26c9d7a1c3a7c2 (patch)
tree26408ef80038d59cd9f713222edd659b30f88253 /test/files/neg/patmatexhaust.scala
parent3949726f1f053c9850d71064ec6c16819248c4e8 (diff)
downloadscala-4cb4ad76b213389b828ae9c1ab26c9d7a1c3a7c2.tar.gz
scala-4cb4ad76b213389b828ae9c1ab26c9d7a1c3a7c2.tar.bz2
scala-4cb4ad76b213389b828ae9c1ab26c9d7a1c3a7c2.zip
Fix and test cases for ticket #443.
flags on AnyVal from FINAL|SEALED to ABSTRACT|SEALED. This appears correct and without ill effect, but if anyone spots new anyval oddness you know where to look.
Diffstat (limited to 'test/files/neg/patmatexhaust.scala')
-rw-r--r--test/files/neg/patmatexhaust.scala28
1 files changed, 25 insertions, 3 deletions
diff --git a/test/files/neg/patmatexhaust.scala b/test/files/neg/patmatexhaust.scala
index b2d0b8ddd2..ffb37f3be6 100644
--- a/test/files/neg/patmatexhaust.scala
+++ b/test/files/neg/patmatexhaust.scala
@@ -1,5 +1,5 @@
class TestSealedExhaustive { // compile only
- sealed class Foo
+ sealed abstract class Foo
case class Bar(x:Int) extends Foo
case object Baz extends Foo
@@ -12,7 +12,7 @@ class TestSealedExhaustive { // compile only
case Baz => // not exhaustive
}
- sealed class Mult
+ sealed abstract class Mult
case class Kult(s:Mult) extends Mult
case class Qult() extends Mult
@@ -32,7 +32,7 @@ class TestSealedExhaustive { // compile only
case (Qult(), Kult(_)) =>
}
- sealed class Deep
+ sealed abstract class Deep
case object Ga extends Deep
sealed class Gp extends Deep
@@ -65,6 +65,28 @@ class TestSealedExhaustive { // compile only
case 1::2::Nil =>
case _ =>
}
+
+ sealed class B
+ case class B1 extends B
+ case object B2 extends B
+ def ma8(x: B) = x match {
+ case _: B => true
+ }
+ def ma9(x: B) = x match {
+ 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
+ }
+
def redundant = 1 match { // include this otherwise script won't test this in files/neg
case 1 =>
case 1 =>