Files
kotlin-fork/compiler/testData/codegen/box/functions/invoke/kt3450getAndInvoke.kt
T
2020-03-04 16:55:33 +03:00

14 lines
336 B
Kotlin
Vendored

//KT-3450 get and invoke are not parsed in one expression
public class A(val s: String) {
operator fun get(i: Int) : A = A("$s + $i")
operator fun invoke(builder : A.() -> String): String = builder()
}
fun x(y : String) : A = A(y)
fun foo() = x("aaa")[42] { "$s!!" }
fun box() = if (foo() == "aaa + 42!!") "OK" else "fail"