diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
commit | 89bacb9c25a58454ff1878e67f7ea07ffc8c269f (patch) | |
tree | 51f1ff6c66aebe1b6109b1cffcc2bb8e4cf760a3 /tests/pending/run/t4560.scala | |
parent | a0fa33deafbea1bf53edc068c5ed9db5592822f9 (diff) | |
download | dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.gz dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.bz2 dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.zip |
Run tests as they were in scala.
Diffstat (limited to 'tests/pending/run/t4560.scala')
-rw-r--r-- | tests/pending/run/t4560.scala | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/pending/run/t4560.scala b/tests/pending/run/t4560.scala new file mode 100644 index 000000000..ee657e47e --- /dev/null +++ b/tests/pending/run/t4560.scala @@ -0,0 +1,69 @@ +// 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) + +// TEST 1 +// self-type is other trait + + +import scala.language.{ reflectiveCalls } + +trait Aa +trait Ab + +trait B { + self: Aa with Ab => + + 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 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 => + + def y = new { def f() = println("Success 3") } + def fail() = { + println('Test) + y.f() + } +} + +object Test3 extends B3 { + def test { fail() } +} + +object Test { + def main(args: Array[String]) { + Test1.fail() + Test2.fail() + Test3.fail() + } +} + |