Files
kotlin-fork/compiler/testData/diagnostics/tests/operatorsOverloading/incForAssignmentSmartCast.kt
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

14 lines
178 B
Kotlin
Vendored

// SKIP_TXT
var c = 1
fun nullable(): Int? = null
fun foo(): Int {
var x = nullable()
if (x == null) {
x = c++
}
return <!DEBUG_INFO_SMARTCAST!>x<!>
}