JS: prove that lambdas in inline function compiled correctly
Obsoletes KT-19712
This commit is contained in:
@@ -4784,6 +4784,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inlineMemberFunWithLambda.kt")
|
||||||
|
public void testInlineMemberFunWithLambda() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/inlineMultiModule/inlineMemberFunWithLambda.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineableAliasForExternalDeclaration.kt")
|
@TestMetadata("inlineableAliasForExternalDeclaration.kt")
|
||||||
public void testInlineableAliasForExternalDeclaration() throws Exception {
|
public void testInlineableAliasForExternalDeclaration() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/inlineMultiModule/inlineableAliasForExternalDeclaration.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/inlineMultiModule/inlineableAliasForExternalDeclaration.kt");
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
// EXPECTED_REACHABLE_NODES: 1017
|
||||||
|
// LANGUAGE_VERSION: 1.2
|
||||||
|
// MODULE: lib
|
||||||
|
// FILE: lib.kt
|
||||||
|
open class C {
|
||||||
|
internal inline fun a(noinline x: () -> String = { "a" }) = x()
|
||||||
|
|
||||||
|
internal inline fun b(): () -> String = { "b" }
|
||||||
|
|
||||||
|
inline fun c(noinline x: () -> String = { "c" }) = x()
|
||||||
|
|
||||||
|
inline fun d(): () -> String = { "d" }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal inline fun test1(): String {
|
||||||
|
val x = C()
|
||||||
|
return x.a() + x.b()() + x.c() + x.d()()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun callTest1(): String = test1()
|
||||||
|
|
||||||
|
// MODULE: main(lib)(lib)
|
||||||
|
// FILE: lib.kt
|
||||||
|
internal inline fun test2(): String {
|
||||||
|
val x = C()
|
||||||
|
return "2" + x.a() + x.b()() + x.c() + x.d()()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val r1 = test1()
|
||||||
|
if (r1 != "abcd") return "fail1: $r1"
|
||||||
|
|
||||||
|
val rc1 = callTest1()
|
||||||
|
if (rc1 != "abcd") return "fail1c: $rc1"
|
||||||
|
|
||||||
|
val r2 = test2()
|
||||||
|
if (r2 != "2abcd") return "fail2: $r2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user