Test for obsolete KT-10044: "Don't know how to generate outer expression for class" with lambda in init block
#KT-10044 Obsolete
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
open class JClass() {
|
||||||
|
fun test(): String {
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Example : JClass {
|
||||||
|
constructor() : super()
|
||||||
|
|
||||||
|
private var obj: JClass? = null
|
||||||
|
|
||||||
|
var result: String? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
{
|
||||||
|
result = obj?.test()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Example2 : JClass {
|
||||||
|
constructor() : super()
|
||||||
|
|
||||||
|
private var obj: JClass? = this
|
||||||
|
|
||||||
|
var result: String? = null
|
||||||
|
|
||||||
|
init {
|
||||||
|
{
|
||||||
|
result = obj?.test()
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val result = Example().result
|
||||||
|
if (result != null) "fail 1: $result"
|
||||||
|
|
||||||
|
return Example2().result!!
|
||||||
|
}
|
||||||
+6
@@ -1753,6 +1753,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt10044.kt")
|
||||||
|
public void testKt10044() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/kt10044.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt2151.kt")
|
@TestMetadata("kt2151.kt")
|
||||||
public void testKt2151() throws Exception {
|
public void testKt2151() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/kt2151.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/closures/kt2151.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user