KT-7819 Add test to ensure that lambda capturing this literal can be inlined
This commit is contained in:
@@ -119,6 +119,12 @@ public class InlineJsTestGenerated extends AbstractInlineJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineCapturingThis.kt")
|
||||
public void testInlineCapturingThis() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inline/cases/inlineCapturingThis.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineChain.kt")
|
||||
public void testInlineChain() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/inline/cases/inlineChain.kt");
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package foo
|
||||
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
|
||||
inline fun block(p: () -> Unit) = p()
|
||||
|
||||
class A(val x: Int) {
|
||||
fun test(): Int {
|
||||
var result: Int = 0
|
||||
block {
|
||||
result = x
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(23, A(23).test())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user