diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t4098.check | 13 | ||||
-rw-r--r-- | test/files/neg/t4098.scala | 22 | ||||
-rw-r--r-- | test/files/neg/t5564.check | 4 | ||||
-rw-r--r-- | test/files/neg/t5564.scala | 9 |
4 files changed, 48 insertions, 0 deletions
diff --git a/test/files/neg/t4098.check b/test/files/neg/t4098.check new file mode 100644 index 0000000000..7d69cf151c --- /dev/null +++ b/test/files/neg/t4098.check @@ -0,0 +1,13 @@ +t4098.scala:3: error: forward reference not allowed from self constructor invocation + this(b) + ^ +t4098.scala:8: error: forward reference not allowed from self constructor invocation + this(b) + ^ +t4098.scala:13: error: forward reference not allowed from self constructor invocation + this(b) + ^ +t4098.scala:18: error: forward reference not allowed from self constructor invocation + this(b) + ^ +four errors found diff --git a/test/files/neg/t4098.scala b/test/files/neg/t4098.scala new file mode 100644 index 0000000000..744d6191b5 --- /dev/null +++ b/test/files/neg/t4098.scala @@ -0,0 +1,22 @@ +class A(a: Any) { + def this() = { + this(b) + def b = new {} + } + + def this(x: Int) = { + this(b) + lazy val b = new {} + } + + def this(x: Int, y: Int) = { + this(b) + val b = new {} + } + + def this(x: Int, y: Int, z: Int) = { + this(b) + println(".") + def b = new {} + } +} diff --git a/test/files/neg/t5564.check b/test/files/neg/t5564.check new file mode 100644 index 0000000000..e7e13ccc9c --- /dev/null +++ b/test/files/neg/t5564.check @@ -0,0 +1,4 @@ +t5564.scala:8: error: inferred type arguments [A] do not conform to method bar's type parameter bounds [B >: A <: C] + def bar[B >: A <: C]: T = throw new Exception + ^ +one error found diff --git a/test/files/neg/t5564.scala b/test/files/neg/t5564.scala new file mode 100644 index 0000000000..663cf88726 --- /dev/null +++ b/test/files/neg/t5564.scala @@ -0,0 +1,9 @@ + + + +trait C + + +class Foo[@specialized(Int) T, A] { + def bar[B >: A <: C]: T = throw new Exception +} |