fab6cec93a
This makes it more consistent and fixes some overlooked corner cases. Also it was decided on the last equality applicability DM (KT-62646) that we'd like `is`/`!is`/`as`/`as?` to work similarly to `===`/`!==`. Also note that it now gives a clearer explaination of why some corner cases work the way they do. For example, `FirPsiDiagnosticTestGenerated.testLambdaInLhsOfTypeOperatorCall` yields `UNCHECKED_CAST` instead of `CAST_NEVER_SUCCEEDS`, because `toTypeInfo()` replaces all type arguments with star projections, even when the argument is not a type parameter. This is because it has been desided to work this way in KT-57779. In `FirPsiOldFrontendDiagnosticsTestGenerated..NeverSucceeds#testNoGenericsRelated` the diagnostic is introduced, because `t2 as FC1` and `FC1` is a final class with no `T5` supertype. `UNCHECKED_CAST` in `FirPsiOldFrontendDiagnosticsTestGenerated.testSmartCast` disappeared, because previously we didn't take smartcasts into account. Note that `FirPsiOldFrontendDiagnosticsTestGenerated.testMappedSubtypes` is a false positive. It appears because `isSubtypeOf()` doesn't take into account platform types in supertypes of the given types (doesn't map them).
47 lines
648 B
Kotlin
Vendored
47 lines
648 B
Kotlin
Vendored
// !DIAGNOSTICS: -USELESS_CAST -UNCHECKED_CAST
|
|
interface T1
|
|
interface T2
|
|
interface T3
|
|
open class OC1: T1
|
|
open class OC2: OC1(), T2
|
|
class FC1: OC2(), T3
|
|
interface T4: <!INTERFACE_WITH_SUPERCLASS!>OC1<!>
|
|
interface T5: T2
|
|
|
|
fun <TP1: OC1, TP2: T2, TP3: OC2> test(
|
|
t2: T2,
|
|
t4: T4,
|
|
fc1: FC1,
|
|
oc1: OC1,
|
|
oc2: OC2,
|
|
tp1: TP1,
|
|
tp2: TP2
|
|
) {
|
|
fc1 as FC1
|
|
fc1 as OC1
|
|
fc1 as T1
|
|
fc1 as TP1
|
|
|
|
oc1 as FC1
|
|
oc1 as OC2
|
|
oc2 as OC1
|
|
oc1 as T2
|
|
oc1 as T1
|
|
oc1 as TP1
|
|
oc1 as TP2
|
|
|
|
t2 as FC1
|
|
t2 as OC2
|
|
t4 as OC1
|
|
t2 as T2
|
|
t2 as T5
|
|
t2 as TP2
|
|
|
|
tp1 as FC1
|
|
tp1 as OC1
|
|
tp1 as OC2
|
|
tp2 as T2
|
|
tp2 as T5
|
|
tp1 as TP3
|
|
}
|