From 35f42b1a65f36e4801f6bf986a87fe4a8d4951b0 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Thu, 28 Nov 2013 10:11:26 +0400 Subject: [PATCH] Tests for KT-4252: Error generating primary constructor with kind OwnerKind #KT-4252 Obsolete --- .../testData/codegen/box/properties/kt4252.kt | 23 ++++++++++++++ .../codegen/box/properties/kt4252_2.kt | 30 +++++++++++++++++++ .../BlackBoxCodegenTestGenerated.java | 10 +++++++ 3 files changed, 63 insertions(+) create mode 100644 compiler/testData/codegen/box/properties/kt4252.kt create mode 100644 compiler/testData/codegen/box/properties/kt4252_2.kt diff --git a/compiler/testData/codegen/box/properties/kt4252.kt b/compiler/testData/codegen/box/properties/kt4252.kt new file mode 100644 index 00000000000..9a8fb30b49c --- /dev/null +++ b/compiler/testData/codegen/box/properties/kt4252.kt @@ -0,0 +1,23 @@ +class CallbackBlock {} + +public class Foo +{ + class object { + private var bar = 0 + } + + { + ++bar + } + + fun getBar(): Int = bar +} + +fun box() : String { + + val foo = Foo() + + if (foo.getBar() != 1) return "Fail"; + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/kt4252_2.kt b/compiler/testData/codegen/box/properties/kt4252_2.kt new file mode 100644 index 00000000000..a608b7c559c --- /dev/null +++ b/compiler/testData/codegen/box/properties/kt4252_2.kt @@ -0,0 +1,30 @@ +class Foo() { + class object { + val bar = "OK"; + var boo = "FAIL"; + } + + val a = bar + var b = Foo.bar + val c: String + var d: String + + { + c = bar + d = Foo.bar + boo = "O" + Foo.boo += "K" + } +} + +fun box(): String { + val foo = Foo() + + if (foo.a != "OK") return "foo.a != OK" + if (foo.b != "OK") return "foo.b != OK" + if (foo.c != "OK") return "foo.c != OK" + if (foo.d != "OK") return "foo.d != OK" + if (Foo.boo != "OK") return "Foo.boo != OK" + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java index 3b98d709d28..2e2394cb3dc 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxCodegenTestGenerated.java @@ -3980,6 +3980,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest("compiler/testData/codegen/box/properties/kt4140.kt"); } + @TestMetadata("kt4252.kt") + public void testKt4252() throws Exception { + doTest("compiler/testData/codegen/box/properties/kt4252.kt"); + } + + @TestMetadata("kt4252_2.kt") + public void testKt4252_2() throws Exception { + doTest("compiler/testData/codegen/box/properties/kt4252_2.kt"); + } + @TestMetadata("kt613.kt") public void testKt613() throws Exception { doTest("compiler/testData/codegen/box/properties/kt613.kt");