[FIR] Unify code of type unification, fix intersection types processing in FirCastDiagnosticsHelpers.kt

This commit is contained in:
Ivan Kochurkin
2021-11-10 14:52:07 +03:00
committed by TeamCityServer
parent 98cce8e05b
commit 5fda933c33
7 changed files with 214 additions and 330 deletions
@@ -1,6 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// KT-10444 Do not ignore smart (unchecked) casts to the same classifier
class Base<in T>
class Qwe<T : Any>(val a: T?) {
fun test1(obj: Any) {
obj <!UNCHECKED_CAST!>as Qwe<T><!>
@@ -12,6 +13,10 @@ class Qwe<T : Any>(val a: T?) {
check(obj.a)
}
fun test2(b: Base<*>) {
b <!UNCHECKED_CAST!>as Base<Any><!>
}
fun check(a: T?) {
}
}
@@ -1,6 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// KT-10444 Do not ignore smart (unchecked) casts to the same classifier
class Base<in T>
class Qwe<T : Any>(val a: T?) {
fun test1(obj: Any) {
obj <!UNCHECKED_CAST!>as Qwe<T><!>
@@ -12,6 +13,10 @@ class Qwe<T : Any>(val a: T?) {
check(obj.a)
}
fun test2(b: Base<*>) {
b <!UNCHECKED_CAST!>as Base<Any><!>
}
fun check(a: T?) {
}
}
@@ -11,6 +11,13 @@ public open class Bar</*0*/ T : Foo> {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Base</*0*/ in T> {
public constructor Base</*0*/ in T>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class Foo {
public constructor Foo()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -26,5 +33,7 @@ public final class Qwe</*0*/ T : kotlin.Any> {
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun test1(/*0*/ obj: Qwe<*>): kotlin.Unit
public final fun test1(/*0*/ obj: kotlin.Any): kotlin.Unit
public final fun test2(/*0*/ b: Base<*>): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}