[NI] CST: add preemptive recursion detection

For single super type constructor create star projection argument when types for that argument are equal to the original types.
Captured star projections are replaced with their corresponding supertypes during this check.
Skip check for `in` parameters, for which recursive cst calculation does not happen.
Adjust constant in fallback recursion condition.

^KT-38544 Fixed
This commit is contained in:
Pavel Kirpichenkov
2020-04-29 20:35:24 +03:00
parent 7cde9b4355
commit 003ba1c8f5
44 changed files with 1505 additions and 59 deletions
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface I1<A : I1<A>>
interface I2<C : I2<C>>
interface I3<E: I3<E>> : I2<E>, I1<E>
interface I4<E: I4<E>> : I2<E>, I1<E>
class C1<F> : I3<C1<F>>
class C2 : I4<C2>
class Box<T>
fun test(c1: C1<Box<Box<Box<Int>>>>, c2: C2) {
val v = select(c1, c2)
<!DEBUG_INFO_EXPRESSION_TYPE("I2<*> & I1<*>")!>v<!>
}
fun <S> select(vararg args: S): S = TODO()
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface I1<A : I1<A>>
interface I2<C : I2<C>>
interface I3<E: I3<E>> : I2<E>, I1<E>
interface I4<E: I4<E>> : I2<E>, I1<E>
class C1<F> : I3<C1<F>>
class C2 : I4<C2>
class Box<T>
fun test(c1: C1<Box<Box<Box<Int>>>>, c2: C2) {
val v = select(c1, c2)
<!DEBUG_INFO_EXPRESSION_TYPE("{I1<*> & I2<*>}")!>v<!>
}
fun <S> select(vararg args: S): S = TODO()
@@ -0,0 +1,49 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun test(/*0*/ c1: C1<Box<Box<Box<kotlin.Int>>>>, /*1*/ c2: C2): kotlin.Unit
public final class Box</*0*/ T> {
public constructor Box</*0*/ 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 final class C1</*0*/ F> : I3<C1<F>> {
public constructor C1</*0*/ F>()
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 C2 : I4<C2> {
public constructor C2()
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 interface I1</*0*/ A : I1<A>> {
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 interface I2</*0*/ C : I2<C>> {
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 interface I3</*0*/ E : I3<E>> : I2<E>, I1<E> {
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface I4</*0*/ E : I4<E>> : I2<E>, I1<E> {
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<in A: Rec<A, B>, in B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<Obj2 & Obj3, I2 & I3>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<Obj2 & Obj4, I2 & I4>")!>cst2<!>
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<in A: Rec<A, B>, in B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<{Obj2 & Obj3}, {I2 & I3}>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<{Obj2 & Obj4}, {I2 & I4}>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ in A : Rec<A, B>, /*1*/ in B> {
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
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<in A: Rec<A, B>, B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<Obj2 & Obj3, out I1>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<Obj2 & Obj4, out kotlin.Any>")!>cst2<!>
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<in A: Rec<A, B>, B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<{Obj2 & Obj3}, out I1>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<{Obj2 & Obj4}, out kotlin.Any>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ in A : Rec<A, B>, /*1*/ B> {
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
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<in A: Rec<A, B>, out B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<Obj2 & Obj3, I1>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<Obj2 & Obj4, kotlin.Any>")!>cst2<!>
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<in A: Rec<A, B>, out B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<{Obj2 & Obj3}, I1>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<{Obj2 & Obj4}, kotlin.Any>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ in A : Rec<A, B>, /*1*/ out B> {
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
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<A: Rec<A, B>, in B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, I2 & I3>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, I2 & I4>")!>cst2<!>
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<A: Rec<A, B>, in B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, {I2 & I3}>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, {I2 & I4}>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ A : Rec<A, B>, /*1*/ in B> {
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
}
@@ -0,0 +1,22 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
interface Rec<A: Rec<A, B>, out B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, I1>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, kotlin.Any>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ A : Rec<A, B>, /*1*/ out B> {
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
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<out A: Rec<A, B>, in B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, I2 & I3>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, I2 & I4>")!>cst2<!>
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
interface Rec<out A: Rec<A, B>, in B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, {I2 & I3}>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, {I2 & I4}>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ out A : Rec<A, B>, /*1*/ in B> {
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
}
@@ -0,0 +1,22 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
interface Rec<out A: Rec<A, B>, B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, out I1>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, out kotlin.Any>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ out A : Rec<A, B>, /*1*/ B> {
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
}
@@ -0,0 +1,22 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
interface Rec<out A: Rec<A, B>, out B>
fun <S> select(vararg args: S): S = TODO()
interface I1
interface I2 : I1
interface I3 : I1
interface I4
object Obj2 : Rec<Obj2, I2>
object Obj3 : Rec<Obj3, I3>
object Obj4 : Rec<Obj4, I4>
fun testOutOut() {
val cst1 = select(Obj2, Obj3)
val cst2 = select(Obj2, Obj4)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, I1>")!>cst1<!>
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*, kotlin.Any>")!>cst2<!>
}
@@ -0,0 +1,55 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun testOutOut(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 interface I4 {
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 object Obj2 : Rec<Obj2, I2> {
private constructor Obj2()
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 object Obj3 : Rec<Obj3, I3> {
private constructor Obj3()
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 object Obj4 : Rec<Obj4, I4> {
private constructor Obj4()
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 interface Rec</*0*/ out A : Rec<A, B>, /*1*/ out B> {
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
}
@@ -0,0 +1,13 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
interface A<T: A<T>>
interface C<T> : A<C<T>>
interface D<T> : A<C<T>>
fun <S> select(vararg args: S): S = TODO()
fun test(c: C<String>, d: D<String>) {
val v = select(c, d)
<!DEBUG_INFO_EXPRESSION_TYPE("A<C<kotlin.String>>")!>v<!>
}
@@ -0,0 +1,22 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun test(/*0*/ c: C<kotlin.String>, /*1*/ d: D<kotlin.String>): kotlin.Unit
public interface A</*0*/ T : A<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 interface C</*0*/ T> : A<C<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 interface D</*0*/ T> : A<C<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
}
@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !WITH_NEW_INFERENCE
interface RecursiveGeneric<T : RecursiveGeneric<T, U>, U>
@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !WITH_NEW_INFERENCE
interface RecursiveGeneric<T : RecursiveGeneric<T, U>, U>
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
fun <S> select(vararg args: S): S = TODO()
interface Rec<T : Rec<T>>
interface I1
interface I2 : I1
interface I3 : I1
object O1 : Rec<O1>, I2
object O2 : Rec<O2>, I3
fun test() {
val cst = select(O1, O2)
<!DEBUG_INFO_EXPRESSION_TYPE("Rec<*> & I1")!>cst<!>
}
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
// !LANGUAGE: +NewInference
fun <S> select(vararg args: S): S = TODO()
interface Rec<T : Rec<T>>
interface I1
interface I2 : I1
interface I3 : I1
object O1 : Rec<O1>, I2
object O2 : Rec<O2>, I3
fun test() {
val cst = select(O1, O2)
<!DEBUG_INFO_EXPRESSION_TYPE("{I1 & Rec<*>}")!>cst<!>
}
@@ -0,0 +1,42 @@
package
public fun </*0*/ S> select(/*0*/ vararg args: S /*kotlin.Array<out S>*/): S
public fun test(): kotlin.Unit
public interface I1 {
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 interface I2 : I1 {
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 interface I3 : I1 {
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 object O1 : Rec<O1>, I2 {
private constructor O1()
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
public object O2 : Rec<O2>, I3 {
private constructor O2()
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface Rec</*0*/ T : Rec<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
}