summaryrefslogtreecommitdiff
path: root/test/files/neg/t7007.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-08-28 16:15:43 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-11 23:22:07 +0200
commit38a488ea17e4ed42b65df4095c2eac738a63f5c4 (patch)
tree703be8007786ac12ebe70274b6c580c76096e869 /test/files/neg/t7007.scala
parentf04257b8414745d8e13bee213e551ef01c839602 (diff)
downloadscala-38a488ea17e4ed42b65df4095c2eac738a63f5c4.tar.gz
scala-38a488ea17e4ed42b65df4095c2eac738a63f5c4.tar.bz2
scala-38a488ea17e4ed42b65df4095c2eac738a63f5c4.zip
SI-7007 Test case shows we disallow premature `this` access
Rather than the old behaviour, which compiled successfully but led us into the jaws of a LinkageError. Related to SI-6666.
Diffstat (limited to 'test/files/neg/t7007.scala')
-rw-r--r--test/files/neg/t7007.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/neg/t7007.scala b/test/files/neg/t7007.scala
new file mode 100644
index 0000000000..e41dccf550
--- /dev/null
+++ b/test/files/neg/t7007.scala
@@ -0,0 +1,14 @@
+class A
+class B extends A
+
+class Crash(b1: Seq[B], b2: Seq[B]) {
+ def this(a: Seq[A]) = this(a.collect{ case b: B => b}, a.collect{ case b: B => b})
+}
+
+object Main extends App {
+
+ // runtime exception with either constructor
+ val c1 = new Crash(Seq(new B, new B))
+ val c2 = new Crash(Seq(new B), Seq(new B))
+
+}