summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t963b.check6
-rw-r--r--test/files/neg/t963b.scala26
-rw-r--r--test/files/pos/arrays3.scala11
3 files changed, 43 insertions, 0 deletions
diff --git a/test/files/neg/t963b.check b/test/files/neg/t963b.check
new file mode 100644
index 0000000000..9918a98c46
--- /dev/null
+++ b/test/files/neg/t963b.check
@@ -0,0 +1,6 @@
+t963b.scala:25: error: type mismatch;
+ found : B.type
+ required: AnyRef{val y: A}
+ B.f(B)
+ ^
+one error found
diff --git a/test/files/neg/t963b.scala b/test/files/neg/t963b.scala
new file mode 100644
index 0000000000..b34aae8095
--- /dev/null
+++ b/test/files/neg/t963b.scala
@@ -0,0 +1,26 @@
+// Soundness bug, at #963 and dup at #2079.
+trait A {
+ type T
+ var v : T
+}
+
+object B {
+ def f(x : { val y : A }) { x.y.v = x.y.v }
+
+ var a : A = _
+ var b : Boolean = false
+ def y : A = {
+ if(b) {
+ a = new A { type T = Int; var v = 1 }
+ a
+ } else {
+ a = new A { type T = String; var v = "" }
+ b = true
+ a
+ }
+ }
+}
+
+object Test extends App {
+ B.f(B)
+}
diff --git a/test/files/pos/arrays3.scala b/test/files/pos/arrays3.scala
new file mode 100644
index 0000000000..f96be0b427
--- /dev/null
+++ b/test/files/pos/arrays3.scala
@@ -0,0 +1,11 @@
+trait Foo {
+ type Repr <: String
+ def f2(x: Repr) = x.length
+}
+trait Fooz[Repr <: Array[_]] {
+ def f0(x: Repr) = x.length
+}
+
+trait Bar[Repr <: List[_]] extends Foo with Fooz[Array[Int]] {
+ def f1(x: Repr) = x.length
+}