Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/kt469.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

30 lines
521 B
Plaintext

// +JDK
package kt469
//KT-512 plusAssign() : Unit does not work properly
import java.util.*
fun bar(list : List<Int>) {
for (i in 1..10) {
list += i // error
}
System.out?.println(list)
}
fun <T> List<T>.plusAssign(t : T) {
add(t)
}
//KT-469 Allow val-reassignment when appropriate functions are defined
fun foo() {
val m = MyNumber(2)
m -= MyNumber(3) //should not be error here
}
class MyNumber(var i: Int) {
fun minusAssign(m : MyNumber) {
i -= m.i
}
}