Evaluate: Fix for evaluating local variables captured by an inline function (KT-17514)

This commit is contained in:
Yan Zhulanow
2017-10-02 15:28:19 +03:00
parent fed5bddde2
commit 43a1162b25
5 changed files with 56 additions and 12 deletions
@@ -0,0 +1,23 @@
package kt17514
fun <T> checkSucceeds(callable: () -> T) = callable()
fun main(args: Array<String>) {
val isPresent = true
val isPresent2 = true
val expectedLibs = listOf("aa", "bb", "cc")
expectedLibs
.forEach {
checkSucceeds {
val isPresent2 = false
//Breakpoint!
val v = isPresent
}
}
}
// EXPRESSION: isPresent
// RESULT: 1: Z
// EXPRESSION: isPresent2
// RESULT: 0: Z
@@ -0,0 +1,11 @@
LineBreakpoint created at kt17514.kt:14
Run Java
Connected to the target VM
kt17514.kt:14
Compile bytecode for isPresent
Compile bytecode for isPresent2
kt17514.kt:14
resuming kt17514.kt:14
Disconnected from the target VM
Process finished with exit code 0