Moving local fun callee generation to CallReceiver
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fun box(): String {
|
||||
fun String.f() = this
|
||||
val vf: String.() -> String = { this }
|
||||
|
||||
val localExt = "O".f() + "K"?.f()
|
||||
if (localExt != "OK") return "localExt $localExt"
|
||||
|
||||
return "O".vf() + "K"?.vf()
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
open class T(var value: Int) {}
|
||||
|
||||
fun plusAssign(): T {
|
||||
|
||||
fun T.plusAssign(s: Int) {
|
||||
value += s
|
||||
}
|
||||
|
||||
var t = T(1)
|
||||
t += 1
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val result = plusAssign().value
|
||||
if (result != 2) return "fail 1: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
open class T(var value: Int) {}
|
||||
|
||||
fun localExtensionOnNullableParameter(): T {
|
||||
|
||||
fun T.local(s: Int) {
|
||||
value += s
|
||||
}
|
||||
|
||||
var t: T? = T(1)
|
||||
t?.local(2)
|
||||
|
||||
return t!!
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val result = localExtensionOnNullableParameter().value
|
||||
if (result != 3) return "fail 2: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user