summaryrefslogtreecommitdiff
path: root/test/files/run/t4560.scala
diff options
context:
space:
mode:
authorJohannes Rudolph <johannes_rudolph@gmx.de>2012-07-22 11:46:02 +0200
committerPaul Phillips <paulp@improving.org>2012-07-24 20:51:39 -0700
commitcf709c2dd23b7f1f659e52bcb8beb098c5d02d50 (patch)
tree97a1bc815852d2b2dc1a3209142267a5645f8114 /test/files/run/t4560.scala
parentc8bdf199476fdd113d28b23793b5e871390cf825 (diff)
downloadscala-cf709c2dd23b7f1f659e52bcb8beb098c5d02d50.tar.gz
scala-cf709c2dd23b7f1f659e52bcb8beb098c5d02d50.tar.bz2
scala-cf709c2dd23b7f1f659e52bcb8beb098c5d02d50.zip
SI-4560 - improved test
Added all the known cases of failing self-types. Added tests for symbol access (SI-4601) as well which should now be fixed for all of the same cases as well.
Diffstat (limited to 'test/files/run/t4560.scala')
-rw-r--r--test/files/run/t4560.scala65
1 files changed, 46 insertions, 19 deletions
diff --git a/test/files/run/t4560.scala b/test/files/run/t4560.scala
index 1392077e46..9979199067 100644
--- a/test/files/run/t4560.scala
+++ b/test/files/run/t4560.scala
@@ -1,39 +1,66 @@
-object Pimper {
- implicit def pimp(i: Int) = new {
- def test: String = i.toString
- }
-}
+// SI-4560 (and SI-4601): Reflection caches are expected in the wrong classfiles
+// with various differing constellations of self-types. This leads to runtime exceptions
+// when the reflection caches are accessed. This tests both reflection cache accesses
+// for structural type method invocations (`y.f()`) (SI-4560) and accesses to symbols which are
+// handled similarly (SI-4601)
-trait A
+// TEST 1
+// self-type is other trait
-trait B {
- self: A =>
+trait Aa
+trait Ab
- def test {
- import Pimper.pimp
+trait B {
+ self: Aa with Ab =>
- println(5.test)
+ def y = new { def f() = println("Success 1") }
+ def fail() = {
+ println('Test)
+ y.f()
}
}
+object Test1 extends Aa with Ab with B
+
+// TEST 2
+// self-type is class
+
class A2
trait B2 {
self: A2 =>
- def test {
- import Pimper.pimp
+ def y = new { def f() = println("Success 2") }
+ def fail() = {
+ println('Test)
+ y.f()
+ }
+}
+
+object Test2 extends A2 with B2
+
+// TEST 3
+// self-type is singleton type
+
+trait B3 {
+ this: Test3.type =>
- println(5.test)
+ def y = new { def f() = println("Success 3") }
+ def fail() = {
+ println('Test)
+ y.f()
}
}
-object Test extends A with B {
+object Test3 extends B3 {
+ def test { fail() }
+}
+
+object Test {
def main(args: Array[String]) {
- test
- Test2.test
+ Test1.fail()
+ Test2.fail()
+ Test3.fail()
}
}
-object Test2 extends A2 with B2
-