KT-11875 Moves code that uncovers the following JS function:
```
function foo (closureParam, closureParam2, ...) {
return function() {
// function body
}
}
```
from FunctionContext to FunctionInlineMutator. The old code causes bug when calling this function like this: `foo(this, ...)`, since first `closureParam` is replaced with `this`. Later, FunctionInlineMutator can't make difference between original `this` inside *function body* and former `closureParam` reference that became `this` after replacement. So, let FunctionInlineMutator replace `this` in *function body* and then substitute closure parameters.
KT-11875 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package foo
|
||||
|
||||
inline fun<T> with1(value: T, p: T.() -> Unit) = value.p()
|
||||
|
||||
class A(val expected: String) {
|
||||
val b = B()
|
||||
|
||||
fun foo(): A {
|
||||
with1(b) {
|
||||
y = expected
|
||||
}
|
||||
return this
|
||||
}
|
||||
}
|
||||
class B() {
|
||||
var y = ""
|
||||
}
|
||||
|
||||
fun box() = A("OK").foo().b.y
|
||||
Reference in New Issue
Block a user