diff --git a/compiler/testData/diagnostics/tests/generics/InconsistentTypeParameterBounds.kt b/compiler/testData/diagnostics/tests/generics/InconsistentTypeParameterBounds.kt new file mode 100644 index 00000000000..71dc57aa668 --- /dev/null +++ b/compiler/testData/diagnostics/tests/generics/InconsistentTypeParameterBounds.kt @@ -0,0 +1,7 @@ +interface A +interface B : A + +interface ListA : List +interface ListB : List + +interface Z<T> where T : ListA, T : ListB diff --git a/compiler/testData/diagnostics/tests/generics/InconsistentTypeParameterBounds.txt b/compiler/testData/diagnostics/tests/generics/InconsistentTypeParameterBounds.txt new file mode 100644 index 00000000000..91618bd3285 --- /dev/null +++ b/compiler/testData/diagnostics/tests/generics/InconsistentTypeParameterBounds.txt @@ -0,0 +1,53 @@ +package + +public interface 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 B : 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 ListA : kotlin.List { + public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun contains(/*0*/ element: A): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.Collection): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): A + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: A): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.Iterator + public abstract override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: A): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun listIterator(): kotlin.ListIterator + public abstract override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.ListIterator + public abstract override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.List + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface ListB : kotlin.List { + public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun contains(/*0*/ element: B): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.Collection): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun get(/*0*/ index: kotlin.Int): B + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun indexOf(/*0*/ element: B): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean + public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.Iterator + public abstract override /*1*/ /*fake_override*/ fun lastIndexOf(/*0*/ element: B): kotlin.Int + public abstract override /*1*/ /*fake_override*/ fun listIterator(): kotlin.ListIterator + public abstract override /*1*/ /*fake_override*/ fun listIterator(/*0*/ index: kotlin.Int): kotlin.ListIterator + public abstract override /*1*/ /*fake_override*/ fun subList(/*0*/ fromIndex: kotlin.Int, /*1*/ toIndex: kotlin.Int): kotlin.List + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public interface Z where T : ListB { + 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 +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 42ebc220416..76deccfaa83 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -6624,6 +6624,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { doTest(fileName); } + @TestMetadata("InconsistentTypeParameterBounds.kt") + public void testInconsistentTypeParameterBounds() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/InconsistentTypeParameterBounds.kt"); + doTest(fileName); + } + @TestMetadata("kt1575-Class.kt") public void testKt1575_Class() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/kt1575-Class.kt");