[box-tests] Added a bunch of tests on local objects in inline lambdas

This commit is contained in:
Igor Chevdar
2022-08-04 20:39:39 +03:00
committed by Space
parent 7090a2716a
commit e38f02b53a
17 changed files with 343 additions and 0 deletions
@@ -368,6 +368,24 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirL
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends A
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -0,0 +1,36 @@
// NO_CHECK_LAMBDA_INLINING
// IGNORE_BACKEND: JVM, WASM
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_OLD_AGAINST_IR
import kotlin.IllegalStateException
// FILE: 1.kt
inline fun <T> mrun(block: () -> T) = block()
inline fun <T> mrunTwice(block: () -> T) : T {
val first = block()
val second = block()
if (first!!::class != second!!::class)
throw IllegalStateException("${first!!::class} != ${second!!::class}")
return first
}
inline fun <T> T.noop() = this
// FILE: 2.kt
fun bar(o: String): String {
val callable = mrun {
fun localAnonymousFun(k: String): String {
fun localAnonymousFunLevel2() = mrunTwice {
object {
fun foo() = o + k
}
}
return localAnonymousFunLevel2().foo()
}
::localAnonymousFun
}.noop()
return callable("K")
}
fun box() = bar("O")
@@ -0,0 +1,34 @@
// NO_CHECK_LAMBDA_INLINING
// IGNORE_BACKEND: JVM, WASM
// IGNORE_BACKEND_MULTI_MODULE: JVM, JVM_MULTI_MODULE_OLD_AGAINST_IR
import kotlin.IllegalStateException
// FILE: 1.kt
inline fun <T> mrun(noinline block: () -> T) = block()
inline fun <T> mrunTwice(block: () -> T) : T {
val first = block()
val second = block()
if (first!!::class != second!!::class)
throw IllegalStateException("${first!!::class} != ${second!!::class}")
return first
}
// FILE: 2.kt
fun bar(o: String): String {
val callable = mrun {
fun localAnonymousFun(k: String): String {
fun localAnonymousFunLevel2() = mrunTwice {
object {
fun foo() = o + k
}
}
return localAnonymousFunLevel2().foo()
}
::localAnonymousFun
}
return callable("K")
}
fun box() = bar("O")
@@ -0,0 +1,24 @@
// NO_CHECK_LAMBDA_INLINING
import kotlin.IllegalStateException
// FILE: 1.kt
inline fun <T> mrun2(noinline block: () -> T, block2: () -> Unit): T { block2(); return block() }
// FILE: 2.kt
fun bar(o: String): String {
val obj = mrun2(
{
object {
fun foo() = o + "K"
}
},
{
fun localFun() = 42
}
)
return obj.foo()
}
fun box() = bar("O")
@@ -368,6 +368,24 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -368,6 +368,24 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -326,6 +326,24 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -326,6 +326,24 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
@@ -290,6 +290,21 @@ public class IrCodegenBoxInlineWasmTestGenerated extends AbstractIrCodegenBoxInl
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt6007.kt");
@@ -40292,6 +40292,24 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_2.kt");
}
@Test
@TestMetadata("kt52795_3.kt")
public void testKt52795_3() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_3.kt");
}
@Test
@TestMetadata("kt52795_4.kt")
public void testKt52795_4() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_4.kt");
}
@Test
@TestMetadata("kt52795_5.kt")
public void testKt52795_5() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/kt52795_5.kt");
}
@Test
@TestMetadata("kt6007.kt")
public void testKt6007() throws Exception {