Propagate exact lambda refs across bytecode slots

This commit is contained in:
sergeych committed 2026-04-21 13:20:27 +03:00
1 parent db3a780645
commit 30c9a5a565
2 files changed
+28

No files matched your search

@@ -346,6 +346,21 @@ class BytecodeRecentOpsTest {
assertEquals(12, scope.eval("calc()").toInt())
}
@Test
fun nestedInlineLambdaParamCallAvoidsCallSlot() = runTest {
val scope = Script.newScope()
scope.eval(
"""
fun calc() {
{ g -> g(10) }({ x -> x + 1 })
}
""".trimIndent()
)
val disasm = scope.disassembleSymbol("calc")
assertFalse(disasm.contains("CALL_SLOT"), disasm)
assertEquals(11, scope.eval("calc()").toInt())
}
@Test
fun letLiteralUsesInlineBytecode() = runTest {
val scope = Script.newScope()