Add a test verifying anonymous object transform is performed correctly with ClassBuilder.
This commit is contained in:
committed by
Ilya Gorbunov
parent
1ae0040ca3
commit
00cb2705da
@@ -0,0 +1,54 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
interface Run {
|
||||
fun run(): String
|
||||
}
|
||||
|
||||
inline fun i2(crossinline s: () -> String): Run {
|
||||
return i1 {
|
||||
object : Run {
|
||||
override fun run(): String {
|
||||
return s()
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun i1(crossinline s: () -> String): Run {
|
||||
return object : Run {
|
||||
override fun run(): String {
|
||||
return s()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
inline fun i4(crossinline s: () -> String): Run {
|
||||
return i3 {
|
||||
object : Run {
|
||||
override fun run(): String {
|
||||
return s()
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun i3(crossinline s: () -> String): Run {
|
||||
return i2 {
|
||||
object : Run {
|
||||
override fun run(): String {
|
||||
return s()
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val i4 = i4 { "OK" }
|
||||
return i4.run()
|
||||
}
|
||||
@@ -115,6 +115,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defineClass.kt")
|
||||
public void testDefineClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6552.kt")
|
||||
public void testKt6552() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt");
|
||||
|
||||
+6
@@ -115,6 +115,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("defineClass.kt")
|
||||
public void testDefineClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/defineClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6552.kt")
|
||||
public void testKt6552() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/anonymousObject/kt6552.kt");
|
||||
|
||||
Reference in New Issue
Block a user