diff options
author | Paul Phillips <paulp@improving.org> | 2009-10-17 12:36:14 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-10-17 12:36:14 +0000 |
commit | 4cb4ad76b213389b828ae9c1ab26c9d7a1c3a7c2 (patch) | |
tree | 26408ef80038d59cd9f713222edd659b30f88253 /test/files | |
parent | 3949726f1f053c9850d71064ec6c16819248c4e8 (diff) | |
download | scala-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')
-rw-r--r-- | test/files/jvm/interpreter.check | 1 | ||||
-rw-r--r-- | test/files/neg/patmatexhaust.check | 9 | ||||
-rw-r--r-- | test/files/neg/patmatexhaust.scala | 28 |
3 files changed, 33 insertions, 5 deletions
diff --git a/test/files/jvm/interpreter.check b/test/files/jvm/interpreter.check index 27f8be2f57..e17cc15a0a 100644 --- a/test/files/jvm/interpreter.check +++ b/test/files/jvm/interpreter.check @@ -219,6 +219,7 @@ defined class Term scala> | | <console>:15: warning: match is not exhaustive! missing combination Term +missing combination Exp def f(e: Exp) = e match { // non-exhaustive warning here ^ diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 66b0f3c8ea..1c46b6c9e5 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -25,8 +25,13 @@ missing combination Gp def ma5(x:Deep) = x match { // Gp ^ -patmatexhaust.scala:70: error: unreachable code +patmatexhaust.scala:75: warning: match is not exhaustive! +missing combination B + + def ma9(x: B) = x match { + ^ +patmatexhaust.scala:92: error: unreachable code case 1 => ^ -5 warnings found +6 warnings found one error found 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 => |