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).
22 lines
480 B
Kotlin
Vendored
22 lines
480 B
Kotlin
Vendored
// WITH_STDLIB
|
|
|
|
// FILE: Test.java
|
|
public interface Test<K> implements I<String> {}
|
|
|
|
// FILE: Test2.java
|
|
public interface Test2<K, M>
|
|
|
|
// FILE: Test3.java
|
|
public interface Test3<K> {}
|
|
|
|
// FILE: I.java
|
|
public interface I<K> {}
|
|
|
|
// FILE: main.kt
|
|
fun main(z: I<String>) {
|
|
z <!UNCHECKED_CAST!>as Test<Test2<Int, *>><!>
|
|
z as Test<Test2<Int, <!UNRESOLVED_REFERENCE!>Foo<!>>>
|
|
z as Test<<!UNRESOLVED_REFERENCE!>Foo<!>>
|
|
z as <!UNRESOLVED_REFERENCE!>Any2<!>
|
|
println(z)
|
|
} |