Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.kt
T
2021-06-10 16:01:13 +03:00

19 lines
515 B
Kotlin
Vendored

// FIR_IDENTICAL
class Foo(var x: Int?) {
init {
if (x != null) {
val y = x
// Error: x is not stable, Type(y) = Int?
<!SMARTCAST_IMPOSSIBLE!>x<!>.hashCode()
y<!UNSAFE_CALL!>.<!>hashCode()
if (y == x) {
// Still error
y<!UNSAFE_CALL!>.<!>hashCode()
}
if (x == null && y != x) {
// Still error
y<!UNSAFE_CALL!>.<!>hashCode()
}
}
}
}