Files
kotlin-fork/compiler/testData/codegen/box/closures/closureOnTopLevel2.kt
T
2019-11-19 11:00:09 +03:00

25 lines
493 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
val p = { "OK" }()
val getter: String
get() = { "OK" }()
fun f() = { "OK" }()
val obj = object : Function0<String> {
override fun invoke() = "OK"
}
fun box(): String {
if (p != "OK") return "FAIL"
if (getter != "OK") return "FAIL"
if (f() != "OK") return "FAIL"
if (obj() != "OK") return "FAIL"
return "OK"
}