Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/safeAs.fir.kt
T
2021-05-05 18:20:51 +03:00

18 lines
348 B
Kotlin
Vendored

// See also KT-10992: we should have no errors for all unsafe hashCode() calls
fun foo(arg: Any?) {
val x = arg <!USELESS_CAST!>as? Any<!> ?: return
arg.hashCode()
x.hashCode()
}
fun bar(arg: Any?) {
arg <!USELESS_CAST!>as? Any<!> ?: return
arg.hashCode()
}
fun gav(arg: Any?) {
arg as? String ?: return
arg.length
}