Forbidden old invokeExtension convention.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
class B
|
||||
|
||||
class A {
|
||||
operator fun B.invoke() = 4
|
||||
}
|
||||
|
||||
class X {
|
||||
operator fun invoke() = 3
|
||||
}
|
||||
|
||||
fun test(a: A, b: B) {
|
||||
with (a) {
|
||||
b()
|
||||
(b)()
|
||||
}
|
||||
|
||||
X()()
|
||||
val x = X()
|
||||
x()
|
||||
(x)()
|
||||
}
|
||||
|
||||
fun test(c: () -> String, e: Int.() -> String) {
|
||||
c()
|
||||
(c)()
|
||||
|
||||
3.e()
|
||||
3.(e)()
|
||||
with(3) {
|
||||
e()
|
||||
(e)()
|
||||
}
|
||||
}
|
||||
|
||||
fun <T, R> with(receiver: T, f: T.() -> R): R = receiver.f()
|
||||
Reference in New Issue
Block a user