KT-7424: add test to show that inlining works for anonymous functions
This commit is contained in:
@@ -35,6 +35,12 @@ public class InlineJsTestGenerated extends AbstractInlineJsTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/inline/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousFunction.kt")
|
||||
public void testAnonymousFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inline/cases/anonymousFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObjectInlineMethod.kt")
|
||||
public void testAnonymousObjectInlineMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inline/cases/anonymousObjectInlineMethod.kt");
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package foo
|
||||
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
|
||||
inline fun <T> block(f: () -> T): T = f()
|
||||
|
||||
fun test() = block(fun(): Int { return 23 })
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(23, test())
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user