41fd43b5e5
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--)
}
}
30 lines
521 B
Plaintext
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
|
|
}
|
|
}
|