diff --git a/compiler/testData/codegen/regressions/kt1976.kt b/compiler/testData/codegen/regressions/kt1976.kt new file mode 100644 index 00000000000..f641b2a30c8 --- /dev/null +++ b/compiler/testData/codegen/regressions/kt1976.kt @@ -0,0 +1,8 @@ +class A { + public val f : ()->String = {"OK"} +} + +fun box(): String { + val a = A() + return a.f() // does not work: (in runtime) ClassCastException: A cannot be cast to jet.Function0 +} diff --git a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java index fda40959c81..e5cd6a61c1f 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/ClassGenTest.java @@ -411,4 +411,9 @@ public class ClassGenTest extends CodegenTestCase { createEnvironmentWithMockJdkAndIdeaAnnotations(CompilerSpecialMode.JDK_HEADERS); blackBoxFile("regressions/kt1726.kt"); } + + public void testKt1976() throws Exception { + createEnvironmentWithMockJdkAndIdeaAnnotations(CompilerSpecialMode.JDK_HEADERS); + blackBoxFile("regressions/kt1976.kt"); + } }