diff --git a/compiler/testData/codegen/regressions/kt1714.kt b/compiler/testData/codegen/regressions/kt1714.kt new file mode 100644 index 00000000000..86f35cde060 --- /dev/null +++ b/compiler/testData/codegen/regressions/kt1714.kt @@ -0,0 +1,23 @@ +trait A { + val method : (() -> Unit )? + val test : Integer +} + +class AImpl : A { + override val method : (() -> Unit )? = { + } + override val test : Integer = Integer(777) +} + +fun test(a : A) { + val method = a.method + if (method != null) { + method() + } +} + +public fun box() : String { + AImpl().test + test(AImpl()) + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/regressions/kt1714_minimal.kt b/compiler/testData/codegen/regressions/kt1714_minimal.kt new file mode 100644 index 00000000000..b2698d614ab --- /dev/null +++ b/compiler/testData/codegen/regressions/kt1714_minimal.kt @@ -0,0 +1,12 @@ +trait A { + val v: Int +} + +class AImpl : A { + override val v: Int = 5 +} + +public fun box() : String { + (AImpl() : A).v + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java index aaa0499c40e..b1f83a50407 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/PropertyGenTest.java @@ -231,4 +231,14 @@ public class PropertyGenTest extends CodegenTestCase { createEnvironmentWithFullJdk(); blackBoxFile("regressions/kt1482.kt"); } + + public void testKt1714() throws Exception { + createEnvironmentWithFullJdk(); + blackBoxFile("regressions/kt1714.kt"); + } + + public void testKt1714_minimal() throws Exception { + createEnvironmentWithFullJdk(); + blackBoxFile("regressions/kt1714_minimal.kt"); + } }