summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/bug3683a.check6
-rw-r--r--test/files/neg/bug3683a.flags1
-rw-r--r--test/files/neg/bug3683a.scala20
-rw-r--r--test/files/neg/bug3683b.check6
-rw-r--r--test/files/neg/bug3683b.scala21
-rw-r--r--test/files/neg/exhausting.check9
-rw-r--r--test/files/neg/exhausting.scala7
7 files changed, 67 insertions, 3 deletions
diff --git a/test/files/neg/bug3683a.check b/test/files/neg/bug3683a.check
new file mode 100644
index 0000000000..a1c5b9c56d
--- /dev/null
+++ b/test/files/neg/bug3683a.check
@@ -0,0 +1,6 @@
+bug3683a.scala:14: error: match is not exhaustive!
+missing combination XX
+
+ w match {
+ ^
+one error found
diff --git a/test/files/neg/bug3683a.flags b/test/files/neg/bug3683a.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/bug3683a.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/bug3683a.scala b/test/files/neg/bug3683a.scala
new file mode 100644
index 0000000000..6d1915213a
--- /dev/null
+++ b/test/files/neg/bug3683a.scala
@@ -0,0 +1,20 @@
+sealed trait Foo
+sealed trait Bar extends Foo
+sealed trait W[T >: Bar <: Foo]
+case class X() extends W[Foo]
+case class XX() extends W[Bar]
+case class Y() extends W[Bar]
+case class Z[T >: Bar <: Foo](
+ z1: W[T]
+) extends W[T]
+
+object Main {
+ // should warn for not including XX()
+ def f1(w: W[Bar]): Int = {
+ w match {
+ // case XX() => 2
+ case Y() => 1
+ case Z(z) => f1(z)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/bug3683b.check b/test/files/neg/bug3683b.check
new file mode 100644
index 0000000000..3952633d1d
--- /dev/null
+++ b/test/files/neg/bug3683b.check
@@ -0,0 +1,6 @@
+bug3683b.scala:15: error: constructor cannot be instantiated to expected type;
+ found : X
+ required: W[Bar]
+ case X() => 1
+ ^
+one error found
diff --git a/test/files/neg/bug3683b.scala b/test/files/neg/bug3683b.scala
new file mode 100644
index 0000000000..646e418121
--- /dev/null
+++ b/test/files/neg/bug3683b.scala
@@ -0,0 +1,21 @@
+sealed trait Foo
+sealed trait Bar extends Foo
+sealed trait W[T >: Bar <: Foo]
+case class X() extends W[Foo]
+case class XX() extends W[Bar]
+case class Y() extends W[Bar]
+case class Z[T >: Bar <: Foo](
+ z1: W[T]
+) extends W[T]
+
+object Main {
+ // should fail for including X()
+ def f1(w: W[Bar]): Int = {
+ w match {
+ case X() => 1
+ case XX() => 2
+ case Y() => 1
+ case Z(z) => f1(z)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/exhausting.check b/test/files/neg/exhausting.check
index 6383a6eaca..d3f2251f79 100644
--- a/test/files/neg/exhausting.check
+++ b/test/files/neg/exhausting.check
@@ -14,11 +14,16 @@ missing combination Bar3
def fail3[T](x: Foo[T]) = x match {
^
exhausting.scala:31: error: match is not exhaustive!
+missing combination Bar2 Bar2
+
+ def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match {
+ ^
+exhausting.scala:36: error: match is not exhaustive!
missing combination Bar1 Bar2
missing combination Bar1 Bar3
missing combination Bar2 Bar1
missing combination Bar2 Bar2
- def fail4[T](xx: (Foo[T], Foo[T])) = xx match {
+ def fail5[T](xx: (Foo[T], Foo[T])) = xx match {
^
-four errors found
+5 errors found
diff --git a/test/files/neg/exhausting.scala b/test/files/neg/exhausting.scala
index 8b1ea817e4..0741d7467b 100644
--- a/test/files/neg/exhausting.scala
+++ b/test/files/neg/exhausting.scala
@@ -28,7 +28,12 @@ object Test {
case Bar1 => "ok"
case Bar2 => "ok"
}
- def fail4[T](xx: (Foo[T], Foo[T])) = xx match {
+ def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match {
+ case (Bar1, Bar1) => ()
+ case (Bar2, Bar3) => ()
+ case (Bar3, _) => ()
+ }
+ def fail5[T](xx: (Foo[T], Foo[T])) = xx match {
case (Bar1, Bar1) => ()
case (Bar2, Bar3) => ()
case (Bar3, _) => ()