Fix IllegalStateException in case of recursive T & Any upper bound

^KT-50542 Fixed
This commit is contained in:
Denis.Zharkov
2022-01-11 18:20:19 +03:00
committed by teamcity
parent afc548d5d9
commit 964cf937c3
10 changed files with 96 additions and 2 deletions
@@ -0,0 +1,11 @@
// !LANGUAGE: +DefinitelyNonNullableTypes
fun <T : Comparable<T & Any>> sort1() {}
fun <T : Comparable<T & Any>?> sort2() {}
class A1<K : Comparable<K & Any>>
class A2<K : Comparable<K & Any>?>
fun <R : T & Any, T> bar() {}
fun <E : E & Any> baz() {}
@@ -0,0 +1,11 @@
// !LANGUAGE: +DefinitelyNonNullableTypes
fun <T : <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>Comparable<T & Any><!>> sort1() {}
fun <T : Comparable<T & Any>?> sort2() {}
class A1<K : Comparable<<!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>K<!> & Any>>
class A2<K : Comparable<<!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>K<!> & Any>?>
fun <R : T & Any, T> bar() {}
fun <<!CYCLIC_GENERIC_UPPER_BOUND!>E : <!INCORRECT_LEFT_COMPONENT_OF_INTERSECTION!>E & Any<!><!>> baz() {}
@@ -0,0 +1,20 @@
package
public fun </*0*/ R : T & Any, /*1*/ T> bar(): kotlin.Unit
public fun </*0*/ E : [ERROR : Cyclic upper bounds]> baz(): kotlin.Unit
public fun </*0*/ T : kotlin.Comparable<T & Any>> sort1(): kotlin.Unit
public fun </*0*/ T : kotlin.Comparable<T & Any>?> sort2(): kotlin.Unit
public final class A1</*0*/ K : kotlin.Comparable<K>> {
public constructor A1</*0*/ K : kotlin.Comparable<K>>()
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 final class A2</*0*/ K : kotlin.Comparable<K>?> {
public constructor A2</*0*/ K : kotlin.Comparable<K>?>()
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
}