[FIR] Add checker for EXPANSIVE_INHERITANCE

^KT-59402 Fixed
This commit is contained in:
Brian Norman
2023-10-20 15:10:28 -05:00
committed by Space Team
parent a991a13295
commit e9983a947f
19 changed files with 266 additions and 68 deletions
@@ -1,14 +0,0 @@
// !DIAGNOSTICS: -UPPER_BOUND_VIOLATED
// FILE: D.java
public interface D<W> {}
// FILE: Q.java
public interface Q<Z1, Z2> {}
// FILE: C.java
public interface C<X> extends D<P<X,X>> {}
// FILE: 1.kt
interface P<Y1, Y2> : Q<C<Y1>, C<D<Y2>>>
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UPPER_BOUND_VIOLATED
// FILE: D.java
@@ -1,16 +0,0 @@
// !DIAGNOSTICS: -UPPER_BOUND_VIOLATED
// FILE: D.java
public interface D<W> {}
// FILE: Q.java
public interface Q<Z1, Z2> {}
// FILE: C.java
public interface C<X> extends D<P<X,X>> {}
// FILE: P.java
public interface P<Y1, Y2> extends Q<C<Y1>, C<D<Y2>>> {}
// FILE: 1.kt
interface P1<YY1, YY2> : P<YY1, YY2>
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UPPER_BOUND_VIOLATED
// FILE: D.java
@@ -1,28 +0,0 @@
// !DIAGNOSTICS: -UPPER_BOUND_VIOLATED
interface A<T>
interface B<T> : A<A<*>>
interface N0<in T>
interface C0<X> : N0<N0<C0<C0<X>>>>
interface N1<in T>
interface C1<X> : N1<N1<C1<C1<X?>>>>
interface C2<T> : C1<C1<T>>
interface C<X> : D<P<X, X>>
interface P<Y1, Y2> : Q<C<Y1>, C<D<Y2>>>
interface Q<Z1, Z2>
interface D<W>
interface E0<T>
interface E1<T : E2>
interface E2 : E0<E1<out E2>>
interface F0<T>
interface F1<T : F2<*>, U : F2<*>>
interface F2<T> : F0<F1<out F2<*>, T>>
interface G0<T>
interface G1<T : U, U : G2<*>>
interface G2<T> : G0<G1<out G2<*>, T>>
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UPPER_BOUND_VIOLATED
interface A<T>
@@ -25,4 +26,8 @@ interface F2<T> : F0<F1<out F2<*>, T>>
interface G0<T>
interface G1<T : U, U : G2<*>>
interface G2<T> : G0<G1<out G2<*>, T>>
interface G2<T> : G0<G1<out G2<*>, T>>
abstract class H0<X> {
inner abstract class H1<Y> : H0<H1<Y>>() // Outer(X) should not be reported as non-expansive
}
@@ -96,6 +96,20 @@ public interface G2</*0*/ T> : G0<G1<out G2<*>, T>> {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public abstract class H0</*0*/ X> {
public constructor H0</*0*/ X>()
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 abstract inner class H1</*0*/ Y> /*captured type parameters: /*1*/ X*/ : H0<H0<X>.H1<Y>> {
public constructor H1</*0*/ Y>()
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 N0</*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