summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/files/neg/t2442.check6
-rw-r--r--test/files/neg/t2442/MySecondEnum.java6
-rw-r--r--test/files/neg/t2442/t2442.scala6
-rw-r--r--test/files/run/t5914.scala26
4 files changed, 37 insertions, 7 deletions
diff --git a/test/files/neg/t2442.check b/test/files/neg/t2442.check
index b45ce3a2f5..714816fd62 100644
--- a/test/files/neg/t2442.check
+++ b/test/files/neg/t2442.check
@@ -2,4 +2,8 @@ t2442.scala:4: error: match may not be exhaustive.
It would fail on the following input: THREE
def f(e: MyEnum) = e match {
^
-one error found
+t2442.scala:11: error: match may not be exhaustive.
+It would fail on the following input: BLUE
+ def g(e: MySecondEnum) = e match {
+ ^
+two errors found
diff --git a/test/files/neg/t2442/MySecondEnum.java b/test/files/neg/t2442/MySecondEnum.java
new file mode 100644
index 0000000000..0f841286de
--- /dev/null
+++ b/test/files/neg/t2442/MySecondEnum.java
@@ -0,0 +1,6 @@
+public enum MySecondEnum {
+ RED(1), BLUE(2) { public void foo() {} };
+ MySecondEnum(int i) {}
+
+ public void foo() {}
+} \ No newline at end of file
diff --git a/test/files/neg/t2442/t2442.scala b/test/files/neg/t2442/t2442.scala
index 4ca0889400..b0a0f3cd41 100644
--- a/test/files/neg/t2442/t2442.scala
+++ b/test/files/neg/t2442/t2442.scala
@@ -6,4 +6,10 @@ class Test {
case TWO => println("two")
// missing case --> exhaustivity warning!
}
+
+ import MySecondEnum._
+ def g(e: MySecondEnum) = e match {
+ case RED => println("red")
+ // missing case --> exhaustivity warning!
+ }
} \ No newline at end of file
diff --git a/test/files/run/t5914.scala b/test/files/run/t5914.scala
index 53cae9be74..45d8815738 100644
--- a/test/files/run/t5914.scala
+++ b/test/files/run/t5914.scala
@@ -1,9 +1,23 @@
-import scala.reflect.runtime.universe._
+import scala.reflect.ClassTag
-object Test extends App {
- val tree: Tree = null
- tree match {
- case TypeTree() => println("lolwut")
- case null => println("correct")
+trait Trees {
+ class Tree
+ implicit val ttTag: ClassTag[TypeTree]
+ type TypeTree <: Tree
+ val TypeTree: TypeTreeExtractor
+ abstract class TypeTreeExtractor {
+ def unapply(t: TypeTree): Option[String]
}
+ def test(tree: Tree) =
+ tree match {
+ case TypeTree(_) => println("lolwut")
+ case null => println("correct")
+ }
+}
+
+object Test extends App with Trees {
+ val ttTag = implicitly[ClassTag[TypeTree]]
+ case class TypeTree(meh: String) extends Tree
+ object TypeTree extends TypeTreeExtractor
+ test(null) // should not crash
} \ No newline at end of file