JS: fix losing lambda in inline function after incremental compilation
See KT-21493 It's hard to maintain staticRef in cached AST. In fact, we don't need it in this optimization. We'll get excessive names in used set, which is ok: non-function names don't matter, they'll be simply ignored. One possible concern: there's more chance to get name same to some function's name and it won't be removed. First, it's not fatal, it won't break the code (but put some excessive code that will likely be removed by DCE). Second, there's same chance of two functions having same names, and we manage to avoid this (otherwise we'll get many problems).
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1128
|
||||
// FILE: a.kt
|
||||
inline fun foo(f: () -> String): () -> String {
|
||||
val result = f()
|
||||
return { result }
|
||||
}
|
||||
|
||||
|
||||
// FILE: main.kt
|
||||
// RECOMPILE
|
||||
fun bar(f: () -> String) = foo(f)()
|
||||
|
||||
fun box(): String = bar { "OK" }
|
||||
Reference in New Issue
Block a user