Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt607.jet
T
Andrey Breslav 41fd43b5e5 GreatSyntacticShift: Syntax for function types, function literals, when and tuples
Bug:
fun loop(var times : Int) {
   while(times > 0) {
        val u : (value : Int) -> Unit = { // This arrow is confusing the lookahead
            System.out?.println(it)
        }
        u(times--)
   }
}
2011-12-20 22:55:25 +04:00

18 lines
300 B
Plaintext

//KT-607 Val reassignment is not marked as an error
package kt607
fun foo(a: A) {
val o = object {
val y : Int
get() = 42
}
<!VAL_REASSIGNMENT!>a.z<!> = 23
<!VAL_REASSIGNMENT!>o.y<!> = 11 //Should be an error here
}
class A() {
val z : Int
get() = 3
}