diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index cbd97ba5526..885ec72b012 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -29189,12 +29189,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt"); } - @Test - @TestMetadata("kt42042.kt") - public void testKt42042() throws Exception { - runTest("compiler/testData/diagnostics/tests/typeParameters/kt42042.kt"); - } - @Test @TestMetadata("kt42396.kt") public void testKt42396() throws Exception { diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt index fd7d66d76f5..61eca16a127 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/inference/components/ConstraintInjector.kt @@ -122,6 +122,17 @@ class ConstraintInjector( constraintIncorporator.incorporate(typeCheckerContext, typeVariable, constraintToIncorporate) } } + + val contextOps = c as? ConstraintSystemOperation + if (!typeCheckerContext.hasConstraintsToProcess() || + (contextOps != null && c.notFixedTypeVariables.all { typeVariable -> + typeVariable.value.constraints.any { constraint -> + constraint.kind == EQUALITY && contextOps.isProperType(constraint.type) + } + }) + ) { + break + } } } diff --git a/compiler/testData/diagnostics/tests/Bounds.kt b/compiler/testData/diagnostics/tests/Bounds.kt index 1f0a3c601b9..d91a22dc5c3 100644 --- a/compiler/testData/diagnostics/tests/Bounds.kt +++ b/compiler/testData/diagnostics/tests/Bounds.kt @@ -7,12 +7,12 @@ package boundsWithSubstitutors class C : A() val a = B() - val a1 = B<Int>() + val a1 = B<Int>() class X() val b = X, C>>() - val b0 = XAny?>() + val b0 = XAny?>() val b1 = X, String>>() // FILE: b.kt diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt index 97c468ee2ea..1e47b515c93 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/innerTP.kt @@ -32,7 +32,7 @@ fun main() { checkSubtype.Inner<*>>(outer.Inner()) checkSubtype.Inner>(outer.bar()) - checkSubtype.Inner>(outer.Inner()) + checkSubtype.Inner>(outer.Inner()) outer.set(outer.bar()) outer.set(outer.Inner()) diff --git a/compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfType.kt b/compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfType.kt index f1b000219af..5f5e0635fee 100644 --- a/compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfType.kt +++ b/compiler/testData/diagnostics/tests/inference/violatingUpperBoundForSelfType.kt @@ -5,5 +5,5 @@ fun > createMap(enumClass: Class) {} fun reproduce() { val enumClass: Class> = "any" as Class> - createMap(enumClass) + createMap(enumClass) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt index 39691f4ef20..1a7ee22adb6 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/classTypeParameterInferredFromArgument.kt @@ -12,6 +12,6 @@ fun test(x: List, y: List) { A("", x) checkType { _>() } A("", y) checkType { _>() } - A("", x) + A("", x) A("", y) } diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt index e31b2bb5152..15182060056 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/innerClass.kt @@ -14,5 +14,5 @@ fun test(x: List, y: List) { Outer().Inner("", y, 1) checkType { _.Inner>() } Outer().Inner("", x, 1) checkType { _.Inner>() } - Outer().Inner("", x, 1) + Outer().Inner("", x, 1) } diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42042.fir.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42042.fir.kt deleted file mode 100644 index 564a991062b..00000000000 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42042.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -sealed class Subtype { - abstract fun cast(value: A1): B1 - class Trivial : Subtype() { - override fun cast(value: A2): B2 = value - } -} - -fun unsafeCast(value: A): B { - val proof: Subtype = Subtype.Trivial() - return proof.cast(value) -} diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt b/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt deleted file mode 100644 index e127db69652..00000000000 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42042.kt +++ /dev/null @@ -1,11 +0,0 @@ -sealed class Subtype { - abstract fun cast(value: A1): B1 - class Trivial : Subtype() { - override fun cast(value: A2): B2 = value - } -} - -fun unsafeCast(value: A): B { - val proof: Subtype = Subtype.Trivial() - return proof.cast(value) -} diff --git a/compiler/testData/diagnostics/tests/typeParameters/kt42042.txt b/compiler/testData/diagnostics/tests/typeParameters/kt42042.txt deleted file mode 100644 index 1472e3562e1..00000000000 --- a/compiler/testData/diagnostics/tests/typeParameters/kt42042.txt +++ /dev/null @@ -1,19 +0,0 @@ -package - -public fun unsafeCast(/*0*/ value: A): B - -public sealed class Subtype { - protected constructor Subtype() - public abstract fun cast(/*0*/ value: A1): B1 - 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 Trivial : Subtype { - public constructor Trivial() - public open override /*1*/ fun cast(/*0*/ value: A2): B2 - 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/testData/diagnostics/tests/typealias/boundsViolationInDeepTypeAliasExpansion.kt b/compiler/testData/diagnostics/tests/typealias/boundsViolationInDeepTypeAliasExpansion.kt index 55aee58d27e..fcf532a4be2 100644 --- a/compiler/testData/diagnostics/tests/typealias/boundsViolationInDeepTypeAliasExpansion.kt +++ b/compiler/testData/diagnostics/tests/typealias/boundsViolationInDeepTypeAliasExpansion.kt @@ -14,4 +14,4 @@ fun test4(x: TC2>() val test6 = TC2>() val test7 = TC2>() -val test8 = TC2List>() +val test8 = TC2List>() diff --git a/compiler/testData/diagnostics/tests/typealias/boundsViolationInTypeAliasExpansion.kt b/compiler/testData/diagnostics/tests/typealias/boundsViolationInTypeAliasExpansion.kt index 98590c1db64..66998fd9bfe 100644 --- a/compiler/testData/diagnostics/tests/typealias/boundsViolationInTypeAliasExpansion.kt +++ b/compiler/testData/diagnostics/tests/typealias/boundsViolationInTypeAliasExpansion.kt @@ -29,4 +29,4 @@ fun test12(x: TCList>) {} val test13 = TC>() val test14 = TC>() val test15 = TC>() -val test16 = TCList>() +val test16 = TCList>() diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 4cac783a240..1fe677c7ed7 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -29285,12 +29285,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/typeParameters/implicitNothingOnDelegates.kt"); } - @Test - @TestMetadata("kt42042.kt") - public void testKt42042() throws Exception { - runTest("compiler/testData/diagnostics/tests/typeParameters/kt42042.kt"); - } - @Test @TestMetadata("kt42396.kt") public void testKt42396() throws Exception {