if a shared variable is a result of the block, release it only after it has been put

#KT-2151 Fixed
This commit is contained in:
Dmitry Jemerov
2012-06-08 17:58:09 +02:00
parent 56310599a5
commit 8baae95531
4 changed files with 37 additions and 4 deletions
@@ -0,0 +1,11 @@
fun foo(): String {
return if (true) {
var x = "OK"
fun foo() { x += "fail" }
x
} else "fail"
}
fun box(): String {
return foo()
}