Closed
Description
Minimized code
object inlinetest:
def test: Int =
inline2(inline1(2.+))
inline def inline1(inline f: Int => Int): Int => Int =
i => f(1)
inline def inline2(inline f: Int => Int): Int =
f(2) + 3
Output
Disassemblied (via CFR) output of test
public int test() {
return BoxesRunTime.unboxToInt((Object)((JFunction1.mcII.sp & Serializable)(JFunction1.mcII.sp & Serializable)i -> {
int x = 1;
return 2 + x;
}).apply((Object)BoxesRunTime.boxToInteger((int)2))) + 3;
}
Expectation
The result should not contain any lambda.
Notes
Manually inlining inline1
produces the intended result
def test: Int =
inline2(i => 2 + 1)
it gets properly inlined
public int test() {
return 6;
}