diff options
author | Martin Odersky <odersky@gmail.com> | 2016-03-02 17:13:16 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-03-02 17:19:03 +0100 |
commit | 69b6b892793e45a7158d006cdfb5554edc5db633 (patch) | |
tree | e9f92408d4903f577b4d0d7c849201b15e45c623 /tests/run | |
parent | 9d3424da9e34905a20783d4f597d1bb02d0df5d0 (diff) | |
download | dotty-69b6b892793e45a7158d006cdfb5554edc5db633.tar.gz dotty-69b6b892793e45a7158d006cdfb5554edc5db633.tar.bz2 dotty-69b6b892793e45a7158d006cdfb5554edc5db633.zip |
LambdaLift redesign
Simplifications in order to avoid the freqent special
casing of constructors and prepare the way for
proper handling of trait constructors (which cause
problems; see pending/pos/llift.scala.
Diffstat (limited to 'tests/run')
-rw-r--r-- | tests/run/llift.scala | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/tests/run/llift.scala b/tests/run/llift.scala index 0c8c9b4be..28456b8cc 100644 --- a/tests/run/llift.scala +++ b/tests/run/llift.scala @@ -7,6 +7,7 @@ class A { } } } + object Test { def foo(x: Int) = { trait B { @@ -18,7 +19,6 @@ object Test { new C().bar } - def f1(x: Int) = { class C1 { def f2 = { @@ -79,10 +79,11 @@ object Test { def f7 = this.f3 f5 } + def f3a = f3 } class C2 extends T2 class C3 extends T1 - new C2().f3 + new C3().f6 + new C2().f3a + new C3().f6 } def f6 = x } @@ -90,11 +91,50 @@ object Test { new C1().f2 } + def f1d(x: Int) = { + trait T1 { + def f2 = { + trait T2 { + def f3: Int = { + def f4 = x + def f5 = f4 + def f7 = this.f3 + f5 + } + def f3a = f3 + } + class C2 extends T2 + class C3 extends T1 + new C2().f3a + new C3().f6 + } + def f6 = x + } + class C1 extends T1 + new C1().f2 + } + + def f1e(x: Int) = { + trait T1 { + def f2 = { + trait T2 { + def f3: Int = x + } + class C2 extends T2 + new C2().f3 + } + def f6 = x + } + class C1 extends T1 + new C1().f6 + } + def main(args: Array[String]) = { assert(foo(3) == 3) assert(f1(4) == 4) assert(f1a(5) == 5) assert(f1b(6) == 6) - assert(f1c(6) == 12) + assert(f1c(7) == 14) + assert(f1d(8) == 16) + assert(f1e(9) == 9) } } |