Files
kotlin-fork/compiler/testData/diagnostics/tests/inference/kt30405.fir.kt
T

16 lines
406 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !LANGUAGE: +ExpectedTypeFromCast
// !CHECK_TYPE
// Issue: KT-30405
inline fun <reified T> foo(): T {
TODO()
}
fun test() {
val fooCall = foo() as String // T in foo should be inferred to String
fooCall checkType { <!UNRESOLVED_REFERENCE!>_<!><String>() }
val safeFooCall = foo() as? String
safeFooCall checkType { <!UNRESOLVED_REFERENCE!>_<!><String?>() }
}