EmptyIntersectionTypeChecker: drop also incompatible supertypes check

Incompatible supertypes check also don't provoke runtime problems
in most situations, because this check is also bound to type argument
conflict. Related to KT-54411
This commit is contained in:
Mikhail Glukhikh
2022-12-05 11:31:20 +01:00
committed by Space Team
parent 29ad5f981c
commit 758a4931e3
6 changed files with 4 additions and 91 deletions
@@ -1,16 +0,0 @@
class Foo<T>
class Bar<T> {
fun <S : T> takeFoo(foo: Foo<in S>) {}
}
class Out<out P>
interface A<K>
interface B<T> : A<T>
interface C<T> : A<T>
fun <K : C<Int>> main() {
val foo = Foo<K>()
Bar<B<String>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Foo<T>
class Bar<T> {
@@ -12,5 +13,5 @@ interface C<T> : A<T>
fun <K : C<Int>> main() {
val foo = Foo<K>()
Bar<B<String>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
Bar<B<String>>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
}
@@ -1,18 +0,0 @@
class Foo<T>
class Bar<T> {
fun <S : T> takeFoo(foo: Foo<in S>) {}
}
class Out<out P>
interface A<K>
interface B2<T> : A<T>
interface C2<T> : A<T>
interface B<T> : B2<T>
interface C<T> : C2<T>
fun <K : C<Int>> main() {
val foo = Foo<K>()
Bar<B<String>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Foo<T>
class Bar<T> {
@@ -14,5 +15,5 @@ interface C<T> : C2<T>
fun <K : C<Int>> main() {
val foo = Foo<K>()
Bar<B<String>>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
Bar<B<String>>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
}