KT-1572 Frontend doesn't mark all vars included in closure as refs.

This commit is contained in:
Svetlana Isakova
2012-03-14 15:07:23 +04:00
parent af9f00c177
commit 9dc9e9984b
8 changed files with 37 additions and 15 deletions
@@ -0,0 +1,23 @@
//KT-1572 Frontend doesn't mark all vars included in closure as refs.
class A(val t : Int) {}
fun testKt1572() : Boolean {
var a = A(0)
var b = A(3)
val changer = {a = b}
b = A(10) // this change has no effect on changer
changer()
return (a.t == 10)
}
fun testPrimitives() : Boolean {
var a = 0
var b = 3
val changer = {a = b}
b = 10
changer()
return (a == 10)
}
fun box() = if (testKt1572() && testPrimitives()) "OK" else "fail"
@@ -15,7 +15,7 @@ open class AllEvenNum() {
}
}
(i++)
(i = i + 1)
}
}