From 9b6e051dc17325fc918fe28a5292c19e19a15051 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Thu, 9 Feb 2012 23:40:43 +0400 Subject: [PATCH] split SuperGenTest.enclosed --- .../super/{enclosed.jet => enclosedFun.jet} | 13 +---------- .../testData/codegen/super/enclosedVar.jet | 22 +++++++++++++++++++ .../jetbrains/jet/codegen/SuperGenTest.java | 10 +++++++-- 3 files changed, 31 insertions(+), 14 deletions(-) rename compiler/testData/codegen/super/{enclosed.jet => enclosedFun.jet} (68%) create mode 100644 compiler/testData/codegen/super/enclosedVar.jet diff --git a/compiler/testData/codegen/super/enclosed.jet b/compiler/testData/codegen/super/enclosedFun.jet similarity index 68% rename from compiler/testData/codegen/super/enclosed.jet rename to compiler/testData/codegen/super/enclosedFun.jet index 705e0b602c2..f67349f1d4d 100644 --- a/compiler/testData/codegen/super/enclosed.jet +++ b/compiler/testData/codegen/super/enclosedFun.jet @@ -8,26 +8,17 @@ trait K : BK { open class M() { open fun x() : Int = 10 - - open var y = 500 } open class N() : M(), K { override fun x() : Int = 20 - override var y = 200 - open class C() : K { fun test1() = x() fun test2() = super@N.x() fun test3() = super@N.x() fun test4() = super.x() - fun test5() = y - fun test6() : Int { - super@N.y += 200 - return super@N.y - } } } @@ -36,7 +27,5 @@ fun box(): String { if (N().C().test2() != 10) return "test2 fail"; if (N().C().test3() != 100) return "test3 fail"; if (N().C().test4() != 100) return "test4 fail"; - if (N().C().test5() != 200) return "test5 fail"; - if (N().C().test6() != 700) return "test6 fail"; return "OK"; -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/super/enclosedVar.jet b/compiler/testData/codegen/super/enclosedVar.jet new file mode 100644 index 00000000000..d1538aba765 --- /dev/null +++ b/compiler/testData/codegen/super/enclosedVar.jet @@ -0,0 +1,22 @@ +open class M() { + open var y = 500 +} + +open class N() : M() { + + override var y = 200 + + open class C() { + fun test5() = y + fun test6() : Int { + super@N.y += 200 + return super@N.y + } + } +} + +fun box(): String { + if (N().C().test5() != 200) return "test5 fail"; + if (N().C().test6() != 700) return "test6 fail"; + return "OK"; +} diff --git a/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java index 6f1792afa31..e6f787af5ff 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/SuperGenTest.java @@ -21,8 +21,14 @@ public class SuperGenTest extends CodegenTestCase { // System.out.println(generateToText()); } - public void testEnclosedMethod () { - blackBoxFile("/super/enclosed.jet"); + public void testEnclosedFun () { + blackBoxFile("/super/enclosedFun.jet"); // System.out.println(generateToText()); } + + public void testEnclosedVar () { + blackBoxFile("/super/enclosedVar.jet"); +// System.out.println(generateToText()); + } + }