Files
kotlin-fork/compiler/testData/ir/irText/expressions/coercionToUnit.fir.kt.txt
T
Denis.Zharkov c0b6a593e0 FIR: Fix incorrect type of block generated for inc operator
Previously, it was obtained from expected type of a variable being assigned,
but it's better to use the type of resulting expression

Initially this part was brought in 4ab0897d7d,
but as we see in commit message and tests it was all about unit-coercion
2021-11-26 19:39:38 +03:00

28 lines
655 B
Kotlin
Vendored

val test1: Function0<Unit>
field = local fun <anonymous>() {
42 /*~> Unit */
}
get
fun test2(mc: MutableCollection<String>) {
mc.add(element = "") /*~> Unit */
}
fun test3() {
{ // BLOCK
val tmp0_safe_receiver: @FlexibleNullability PrintStream? = #out
when {
EQEQ(arg0 = tmp0_safe_receiver, arg1 = null) -> null
else -> tmp0_safe_receiver.println(p0 = "Hello,")
}
} /*~> Unit */
{ // BLOCK
val tmp1_safe_receiver: @FlexibleNullability PrintStream? = #out
when {
EQEQ(arg0 = tmp1_safe_receiver, arg1 = null) -> null
else -> tmp1_safe_receiver.println(p0 = "world!")
}
} /*~> Unit */
}