Fixes for KT-4991: Prefix/postfix expressions resolved to local extensions are not supported in codegen;
KT-4989: Verify error on local functions and extensions; KT-4987: NegativeArraySizeException on local extension convention function on nullable Int #KT-4991 Fixed #KT-4989 Fixed #KT-4987 Fixed
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
fun box(): String {
|
||||
fun Int?.inc() = (this ?: 0) + 1
|
||||
var counter: Int? = null
|
||||
counter++
|
||||
return if (counter == 1) "OK" else "fail: $counter"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
var a = A()
|
||||
var b = A()
|
||||
|
||||
class A(var value: Int = 0)
|
||||
|
||||
fun prefix(inc: A.() -> A) {
|
||||
++a
|
||||
}
|
||||
|
||||
fun postfix(inc: A.() -> A) {
|
||||
b++
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
prefix { ++value; this }
|
||||
|
||||
if (a.value != 1) return "fail 1"
|
||||
|
||||
postfix { value++; this }
|
||||
|
||||
if (b.value != 1) return "fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user