Introduce Variable: Do not compare explicit receivers using ReceiverValue

#KT-5319 Fixed
This commit is contained in:
Alexey Sedunov
2014-06-25 13:56:33 +04:00
parent 1452ffec6d
commit cd44bc3fb0
10 changed files with 116 additions and 6 deletions
@@ -0,0 +1,12 @@
fun main(args: Array<String>) {
with(A()) {
println(<selection>prop</selection>)
println(prop)
}
}
class A {
val prop = 1
}
public inline fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
@@ -0,0 +1,13 @@
fun main(args: Array<String>) {
with(A()) {
val i = prop
println(i)
println(i)
}
}
class A {
val prop = 1
}
public inline fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
@@ -0,0 +1,4 @@
fun main(args: Array<String>) {
println(<selection>a1</selection>)
println(a2)
}
@@ -0,0 +1,5 @@
fun main(args: Array<String>) {
val a = a1
println(a)
println(a2)
}
@@ -0,0 +1,9 @@
fun main(args: Array<String>) {
val myA = A()
println(<selection>myA.prop</selection>)
println(myA.prop)
}
class A {
val prop = 1
}
@@ -0,0 +1,10 @@
fun main(args: Array<String>) {
val myA = A()
val i = myA.prop
println(i)
println(i)
}
class A {
val prop = 1
}
@@ -0,0 +1,12 @@
class Bar {
}
class Foo() {
fun Bar.invoke(): Int = 1
}
fun main(args: Array<String>) {
val f = Foo()
println(<selection>Bar().f()</selection>)
println(Bar().f())
}
@@ -0,0 +1,13 @@
class Bar {
}
class Foo() {
fun Bar.invoke(): Int = 1
}
fun main(args: Array<String>) {
val f = Foo()
val i = Bar().f()
println(i)
println(i)
}