aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/i1352.scala15
-rw-r--r--tests/pos/i1366.scala6
-rw-r--r--tests/run/i1387.scala6
-rw-r--r--tests/run/redundantParents.check8
-rw-r--r--tests/run/redundantParents.scala30
5 files changed, 65 insertions, 0 deletions
diff --git a/tests/pos/i1352.scala b/tests/pos/i1352.scala
new file mode 100644
index 000000000..b73ef33fc
--- /dev/null
+++ b/tests/pos/i1352.scala
@@ -0,0 +1,15 @@
+object Test {
+ trait A
+ trait B
+ abstract sealed class Parent
+ class Foo extends Parent with A
+ class Bar extends Parent with B
+
+ (null: Parent) match {
+ case (_: A) | (_: B) =>
+ /*
+ * This case would incorrectly be reported as an error,
+ * due to a typo in IsInstanceOfEvaluator
+ */
+ }
+}
diff --git a/tests/pos/i1366.scala b/tests/pos/i1366.scala
new file mode 100644
index 000000000..b75af68b1
--- /dev/null
+++ b/tests/pos/i1366.scala
@@ -0,0 +1,6 @@
+object Test {
+
+ val a: Char = 98
+ val c: (Char, Char) = ('a', 98)
+
+}
diff --git a/tests/run/i1387.scala b/tests/run/i1387.scala
new file mode 100644
index 000000000..fe6b3756e
--- /dev/null
+++ b/tests/run/i1387.scala
@@ -0,0 +1,6 @@
+object Test {
+
+ def main(args: Array[String]): Unit =
+ classOf[java.nio.file.AccessMode].getEnumConstants
+
+}
diff --git a/tests/run/redundantParents.check b/tests/run/redundantParents.check
new file mode 100644
index 000000000..4c7e367ce
--- /dev/null
+++ b/tests/run/redundantParents.check
@@ -0,0 +1,8 @@
+C1 super class: class java.lang.Object
+C1 interfaces: List(interface T2)
+C2 super class: class C1
+C2 interfaces: List(interface T4, interface T5)
+C3 super class: class C1
+C3 interfaces: List(interface T5)
+C4 super class: class C2
+C4 interfaces: List()
diff --git a/tests/run/redundantParents.scala b/tests/run/redundantParents.scala
new file mode 100644
index 000000000..0cd277bbb
--- /dev/null
+++ b/tests/run/redundantParents.scala
@@ -0,0 +1,30 @@
+
+trait T1
+trait T2 extends T1
+trait T3 extends T2
+trait T4 extends T3
+
+trait T5
+
+class C1 extends T2
+class C2 extends C1 with T4 with T5 with T1 with T2
+class C3 extends C1 with T5
+class C4 extends C2 with T5
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val c1 = (new C1).getClass
+ val c2 = (new C2).getClass
+ val c3 = (new C3).getClass
+ val c4 = (new C4).getClass
+
+ println("C1 super class: " + c1.getSuperclass)
+ println("C1 interfaces: " + c1.getInterfaces.toList)
+ println("C2 super class: " + c2.getSuperclass)
+ println("C2 interfaces: " + c2.getInterfaces.toList)
+ println("C3 super class: " + c3.getSuperclass)
+ println("C3 interfaces: " + c3.getInterfaces.toList)
+ println("C4 super class: " + c4.getSuperclass)
+ println("C4 interfaces: " + c4.getInterfaces.toList)
+ }
+}