Add tests with loop in store-load chains on noinline function parameters
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
// NO_CHECK_LAMBDA_INLINING
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
inline fun test(noinline foo: () -> String, noinline bar: () -> String): String {
|
||||||
|
var vfoo = foo
|
||||||
|
var vbar = bar
|
||||||
|
var vres = foo
|
||||||
|
for (i in 1 .. 4) {
|
||||||
|
vres = vbar
|
||||||
|
vbar = vfoo
|
||||||
|
vfoo = vres
|
||||||
|
}
|
||||||
|
return vres()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: 2.kt
|
||||||
|
fun box(): String =
|
||||||
|
test({ "OK" }, { "wrong lambda" })
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// FILE: 1.kt
|
||||||
|
inline fun cycle(p: String): String {
|
||||||
|
var z = p
|
||||||
|
var x = z
|
||||||
|
for (i in 1..4) {
|
||||||
|
z = x
|
||||||
|
x = z
|
||||||
|
}
|
||||||
|
return z
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun test(crossinline foo: String.() -> String): String {
|
||||||
|
val cycle = cycle("123");
|
||||||
|
|
||||||
|
{
|
||||||
|
cycle.foo()
|
||||||
|
}()
|
||||||
|
|
||||||
|
|
||||||
|
return cycle.foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: 2.kt
|
||||||
|
fun box(): String = test { "OK" }
|
||||||
@@ -2432,6 +2432,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInStoreLoadChains.kt")
|
||||||
|
public void testLoopInStoreLoadChains() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInStoreLoadChains2.kt")
|
||||||
|
public void testLoopInStoreLoadChains2() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("plusAssign.kt")
|
@TestMetadata("plusAssign.kt")
|
||||||
public void testPlusAssign() throws Exception {
|
public void testPlusAssign() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/plusAssign.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/plusAssign.kt");
|
||||||
|
|||||||
+12
@@ -2432,6 +2432,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInStoreLoadChains.kt")
|
||||||
|
public void testLoopInStoreLoadChains() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInStoreLoadChains2.kt")
|
||||||
|
public void testLoopInStoreLoadChains2() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("plusAssign.kt")
|
@TestMetadata("plusAssign.kt")
|
||||||
public void testPlusAssign() throws Exception {
|
public void testPlusAssign() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/plusAssign.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/special/plusAssign.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user