summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/checksensible.check5
-rw-r--r--test/files/neg/t5352.check13
-rw-r--r--test/files/neg/t5352.flags1
-rw-r--r--test/files/neg/t5352.scala15
-rw-r--r--test/files/neg/t5426.check13
-rw-r--r--test/files/neg/t5426.flags1
-rw-r--r--test/files/neg/t5426.scala10
-rw-r--r--test/files/run/buffer-slice.check1
-rw-r--r--test/files/run/buffer-slice.scala5
-rw-r--r--test/files/run/virtpatmat_switch.check7
-rw-r--r--test/files/run/virtpatmat_switch.flags1
-rw-r--r--test/files/run/virtpatmat_switch.scala32
-rw-r--r--test/pending/run/t5427a.check1
-rw-r--r--test/pending/run/t5427a.scala10
-rw-r--r--test/pending/run/t5427b.check1
-rw-r--r--test/pending/run/t5427b.scala11
-rw-r--r--test/pending/run/t5427c.check1
-rw-r--r--test/pending/run/t5427c.scala13
-rw-r--r--test/pending/run/t5427d.check1
-rw-r--r--test/pending/run/t5427d.scala11
20 files changed, 152 insertions, 1 deletions
diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check
index 0881205bb4..d785179a56 100644
--- a/test/files/neg/checksensible.check
+++ b/test/files/neg/checksensible.check
@@ -28,6 +28,9 @@ checksensible.scala:27: error: comparing values of types Int and Unit using `=='
checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false
1 == "abc"
^
+checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false
+ Some(1) == 1 // as above
+ ^
checksensible.scala:38: error: comparing a fresh object using `==' will always yield false
new AnyRef == 1
^
@@ -94,4 +97,4 @@ checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and
checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true
while ((c = in.read) != -1)
^
-32 errors found
+33 errors found
diff --git a/test/files/neg/t5352.check b/test/files/neg/t5352.check
new file mode 100644
index 0000000000..d24b0e8ee1
--- /dev/null
+++ b/test/files/neg/t5352.check
@@ -0,0 +1,13 @@
+t5352.scala:11: error: type mismatch;
+ found : boop.Bar
+ required: boop.BarF
+ (which expands to) AnyRef{def f(): Int}
+ x = xs.head
+ ^
+t5352.scala:14: error: method f in class Bar1 cannot be accessed in boop.Bar1
+ Access to protected method f not permitted because
+ enclosing object boop is not a subclass of
+ class Bar1 in object boop where target is defined
+ (new Bar1).f
+ ^
+two errors found
diff --git a/test/files/neg/t5352.flags b/test/files/neg/t5352.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t5352.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t5352.scala b/test/files/neg/t5352.scala
new file mode 100644
index 0000000000..6ee41f5680
--- /dev/null
+++ b/test/files/neg/t5352.scala
@@ -0,0 +1,15 @@
+object boop {
+ abstract class Bar { protected def f(): Any }
+ class Bar1 extends Bar { protected def f(): Int = 5 }
+ class Bar2 extends Bar { protected def f(): Int = 5 }
+
+ val xs = List(new Bar1, new Bar2)
+
+ type BarF = { def f(): Int }
+
+ var x: BarF = _
+ x = xs.head
+ x.f
+
+ (new Bar1).f
+}
diff --git a/test/files/neg/t5426.check b/test/files/neg/t5426.check
new file mode 100644
index 0000000000..d9e192d3f0
--- /dev/null
+++ b/test/files/neg/t5426.check
@@ -0,0 +1,13 @@
+t5426.scala:2: error: comparing values of types Some[Int] and Int using `==' will always yield false
+ def f1 = Some(5) == 5
+ ^
+t5426.scala:3: error: comparing values of types Int and Some[Int] using `==' will always yield false
+ def f2 = 5 == Some(5)
+ ^
+t5426.scala:8: error: comparing values of types Int and Some[Int] using `==' will always yield false
+ (x1 == x2)
+ ^
+t5426.scala:9: error: comparing values of types Some[Int] and Int using `==' will always yield false
+ (x2 == x1)
+ ^
+four errors found
diff --git a/test/files/neg/t5426.flags b/test/files/neg/t5426.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t5426.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t5426.scala b/test/files/neg/t5426.scala
new file mode 100644
index 0000000000..f2fb5cc12c
--- /dev/null
+++ b/test/files/neg/t5426.scala
@@ -0,0 +1,10 @@
+class A {
+ def f1 = Some(5) == 5
+ def f2 = 5 == Some(5)
+
+ val x1 = 5
+ val x2 = Some(5)
+
+ (x1 == x2)
+ (x2 == x1)
+}
diff --git a/test/files/run/buffer-slice.check b/test/files/run/buffer-slice.check
new file mode 100644
index 0000000000..5287aa9d7b
--- /dev/null
+++ b/test/files/run/buffer-slice.check
@@ -0,0 +1 @@
+ArrayBuffer()
diff --git a/test/files/run/buffer-slice.scala b/test/files/run/buffer-slice.scala
new file mode 100644
index 0000000000..ddd82e0751
--- /dev/null
+++ b/test/files/run/buffer-slice.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ println(scala.collection.mutable.ArrayBuffer().slice(102450392, -2045033354))
+ }
+}
diff --git a/test/files/run/virtpatmat_switch.check b/test/files/run/virtpatmat_switch.check
new file mode 100644
index 0000000000..6ded95c010
--- /dev/null
+++ b/test/files/run/virtpatmat_switch.check
@@ -0,0 +1,7 @@
+zero
+one
+many
+got a
+got b
+got some letter
+scala.MatchError: 5 (of class java.lang.Integer) \ No newline at end of file
diff --git a/test/files/run/virtpatmat_switch.flags b/test/files/run/virtpatmat_switch.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/run/virtpatmat_switch.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/run/virtpatmat_switch.scala b/test/files/run/virtpatmat_switch.scala
new file mode 100644
index 0000000000..2e2c31e8e5
--- /dev/null
+++ b/test/files/run/virtpatmat_switch.scala
@@ -0,0 +1,32 @@
+object Test extends App {
+ def intSwitch(x: Int) = x match {
+ case 0 => "zero"
+ case 1 => "one"
+ case _ => "many"
+ }
+
+ println(intSwitch(0))
+ println(intSwitch(1))
+ println(intSwitch(10))
+
+ def charSwitch(x: Char) = x match {
+ case 'a' => "got a"
+ case 'b' => "got b"
+ case _ => "got some letter"
+ }
+
+ println(charSwitch('a'))
+ println(charSwitch('b'))
+ println(charSwitch('z'))
+
+ def implicitDefault(x: Int) = x match {
+ case 0 => 0
+ }
+
+ try {
+ implicitDefault(5)
+ } catch {
+ case e: MatchError => println(e)
+ }
+
+}
diff --git a/test/pending/run/t5427a.check b/test/pending/run/t5427a.check
new file mode 100644
index 0000000000..d8263ee986
--- /dev/null
+++ b/test/pending/run/t5427a.check
@@ -0,0 +1 @@
+2 \ No newline at end of file
diff --git a/test/pending/run/t5427a.scala b/test/pending/run/t5427a.scala
new file mode 100644
index 0000000000..27b28da0ac
--- /dev/null
+++ b/test/pending/run/t5427a.scala
@@ -0,0 +1,10 @@
+import scala.reflect.mirror._
+
+object Foo { val bar = 2 }
+
+object Test extends App {
+ val tpe = getType(Foo)
+ val bar = tpe.nonPrivateMember(newTermName("bar"))
+ val value = getValue(Foo, bar)
+ println(value)
+} \ No newline at end of file
diff --git a/test/pending/run/t5427b.check b/test/pending/run/t5427b.check
new file mode 100644
index 0000000000..d8263ee986
--- /dev/null
+++ b/test/pending/run/t5427b.check
@@ -0,0 +1 @@
+2 \ No newline at end of file
diff --git a/test/pending/run/t5427b.scala b/test/pending/run/t5427b.scala
new file mode 100644
index 0000000000..7a92b6ebbe
--- /dev/null
+++ b/test/pending/run/t5427b.scala
@@ -0,0 +1,11 @@
+import scala.reflect.mirror._
+
+class Foo { val bar = 2 }
+
+object Test extends App {
+ val foo = new Foo
+ val tpe = getType(foo)
+ val bar = tpe.nonPrivateMember(newTermName("bar"))
+ val value = getValue(foo, bar)
+ println(value)
+} \ No newline at end of file
diff --git a/test/pending/run/t5427c.check b/test/pending/run/t5427c.check
new file mode 100644
index 0000000000..32c91abbd6
--- /dev/null
+++ b/test/pending/run/t5427c.check
@@ -0,0 +1 @@
+no public member \ No newline at end of file
diff --git a/test/pending/run/t5427c.scala b/test/pending/run/t5427c.scala
new file mode 100644
index 0000000000..ab41d8b8cd
--- /dev/null
+++ b/test/pending/run/t5427c.scala
@@ -0,0 +1,13 @@
+import scala.reflect.mirror._
+
+class Foo(bar: Int)
+
+object Test extends App {
+ val foo = new Foo(2)
+ val tpe = getType(foo)
+ val bar = tpe.nonPrivateMember(newTermName("bar"))
+ bar match {
+ case NoSymbol => println("no public member")
+ case _ => println("i'm screwed")
+ }
+} \ No newline at end of file
diff --git a/test/pending/run/t5427d.check b/test/pending/run/t5427d.check
new file mode 100644
index 0000000000..d8263ee986
--- /dev/null
+++ b/test/pending/run/t5427d.check
@@ -0,0 +1 @@
+2 \ No newline at end of file
diff --git a/test/pending/run/t5427d.scala b/test/pending/run/t5427d.scala
new file mode 100644
index 0000000000..fd4c62e876
--- /dev/null
+++ b/test/pending/run/t5427d.scala
@@ -0,0 +1,11 @@
+import scala.reflect.mirror._
+
+class Foo(val bar: Int)
+
+object Test extends App {
+ val foo = new Foo(2)
+ val tpe = getType(foo)
+ val bar = tpe.nonPrivateMember(newTermName("bar"))
+ val value = getValue(foo, bar)
+ println(value)
+} \ No newline at end of file