Add tests on coercion to Unit for callable references

#KT-11723
This commit is contained in:
Alexander Udalov
2017-08-23 17:21:10 +03:00
parent 9babd90999
commit 0c8b231fde
8 changed files with 128 additions and 0 deletions
@@ -0,0 +1,20 @@
// !LANGUAGE: +NewInference
// IGNORE_BACKEND: JS_IR, JVM_IR
// 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"
}