Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/innerClasses/innerUncheckedCast.fir.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

32 lines
732 B
Kotlin
Vendored

// !CHECK_TYPE
class Outer<E> {
inner open class InnerBase<F>
inner class Inner<H> : InnerBase<H>() {
val prop: E = null!!
}
fun foo(x: InnerBase<String>, y: Any?, z: Outer<*>.InnerBase<String>) {
if (x is Inner) {
x.prop.checkType { _<E>() }
}
if (y is <!NO_TYPE_ARGUMENTS_ON_RHS!>Inner<!>) return
if (z is Inner) {
z.prop.checkType { _<Any?>() }
return
}
if (y is Outer<*>.Inner<*>) {
y.prop.checkType { _<Any?>() }
}
}
fun bar(x: InnerBase<String>, y: Any?, z: Outer<*>.InnerBase<String>) {
x as Inner
y as <!NO_TYPE_ARGUMENTS_ON_RHS!>Inner<!>
z as Inner
}
}