summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t1705.check7
-rwxr-xr-xtest/files/neg/t1705.scala35
-rwxr-xr-xtest/files/run/existentials.scala2
3 files changed, 43 insertions, 1 deletions
diff --git a/test/files/neg/t1705.check b/test/files/neg/t1705.check
new file mode 100644
index 0000000000..7f75bd0fb5
--- /dev/null
+++ b/test/files/neg/t1705.check
@@ -0,0 +1,7 @@
+t1705.scala:9: error: can't existentially abstract over parameterized type this.T[Z]
+ val c = new C{
+ ^
+t1705.scala:14: error: can't existentially abstract over parameterized type C[String]
+ val x1 = {
+ ^
+two errors found
diff --git a/test/files/neg/t1705.scala b/test/files/neg/t1705.scala
new file mode 100755
index 0000000000..fabdca0ec6
--- /dev/null
+++ b/test/files/neg/t1705.scala
@@ -0,0 +1,35 @@
+package trials
+object crashing {
+ trait C {
+ abstract class T[A] {
+ def f[Z] (a:T[Z]) : T[A]
+ }
+ }
+ abstract class Thing {
+ val c = new C{
+ class T[A](a:A) {
+ def f[Z](t:T[Z]) = new T(a)
+ }
+ }
+ val x1 = {
+ class C[T] { val x: T }
+ new C[String]
+ }
+ }
+}
+/*
+
+Infinite loop in Typer.addLocals. Printing all calls to it:
+
+addLocals: Unit
+addLocals: this.T[A]
+addLocals: java.lang.Object with crashing.C{ ... }
+addLocals: >: Nothing <: java.lang.Object with crashing.C{type T[A] <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[A]}}
+addLocals: >: Nothing <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[Z]}
+addLocals: >: Nothing <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[Z]}
+addLocals: >: Nothing <: java.lang.Object with ScalaObject{def f[Z](this.T[Z]): this.T[Z]}
+[...]
+*
+ C { type T[A] <: { def f[Z]: T[Z] => T[A] } }
+
+*/
diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala
index 469112b392..471f8fe779 100755
--- a/test/files/run/existentials.scala
+++ b/test/files/run/existentials.scala
@@ -52,7 +52,7 @@ object Bug1189 {
object Test extends Application {
- val x = { class I[T]; (new C(new I[String]), new C(new I[Int])) }
+ val x = { class I; class J; (new C(new I), new C(new J)) }
val y: (C[X], C[Y]) forSome { type X; type Y } = x
def foo(x : Counter[T] { def name : String } forSome { type T }) = x match {