Files
kotlin-fork/compiler/testData/codegen/box/callableReference/bound/coercionToUnit.kt
T
2020-11-09 16:04:43 +03:00

23 lines
414 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BINDING_RECEIVERS
// KJS_WITH_FULL_RUNTIME
// !LANGUAGE: +NewInference
// WITH_RUNTIME
class Foo
class Builder {
var size: Int = 0
fun addFoo(foo: Foo): Builder {
size++
return this
}
}
fun box(): String {
val b = Builder()
listOf(Foo(), Foo(), Foo()).forEach(b::addFoo)
return if (b.size == 3) "OK" else "Fail"
}