diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt index 917794c0b1f..1a4957c0a67 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/ConstraintSystemCompleter.kt @@ -31,7 +31,6 @@ import org.jetbrains.kotlin.resolve.calls.inference.model.NewConstraintSystemImp import org.jetbrains.kotlin.resolve.calls.inference.model.NotEnoughInformationForTypeParameter import org.jetbrains.kotlin.resolve.calls.inference.model.VariableWithConstraints import org.jetbrains.kotlin.resolve.calls.model.PostponedAtomWithRevisableExpectedType -import org.jetbrains.kotlin.types.model.KotlinTypeMarker import org.jetbrains.kotlin.types.model.TypeConstructorMarker import org.jetbrains.kotlin.types.model.TypeVariableMarker import org.jetbrains.kotlin.utils.addIfNotNull @@ -262,7 +261,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c return false } - fixVariable(this, topLevelType, variableWithConstraints, postponedArguments) + fixVariable(this, variableWithConstraints) return true } @@ -388,12 +387,13 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c private fun fixVariable( c: ConstraintSystemCompletionContext, - topLevelType: KotlinTypeMarker, - variableWithConstraints: VariableWithConstraints, - postponedResolveKtPrimitives: List + variableWithConstraints: VariableWithConstraints ) { - val direction = TypeVariableDirectionCalculator(c, postponedResolveKtPrimitives, topLevelType).getDirection(variableWithConstraints) - val resultType = inferenceComponents.resultTypeResolver.findResultType(c, variableWithConstraints, direction) + val resultType = inferenceComponents.resultTypeResolver.findResultType( + c, + variableWithConstraints, + TypeVariableDirectionCalculator.ResolveDirection.UNKNOWN + ) val variable = variableWithConstraints.typeVariable c.fixVariable(variable, resultType, ConeFixVariableConstraintPosition(variable)) // TODO: obtain atom for diagnostics } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.fir.kt deleted file mode 100644 index 1122f6a421f..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.fir.kt +++ /dev/null @@ -1,53 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE - -@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") - -import kotlin.internal.OnlyInputTypes - -interface Bound -class First : Bound -class Second : Bound -class Inv(val v: I) -class InvB(val v: I) -class In(v: C) -class InB(v: C) -class Out(val v: O) -class OutB(val v: O) - -fun <@OnlyInputTypes M> strictId(arg: M): M = arg -fun <@OnlyInputTypes S> strictSelect(arg1: S, arg2: S): S = arg1 - -fun testOK(first: First, bound: Bound, second: Second) { - strictId(Inv(15)) - strictId(Inv("foo")) - strictId(Inv(first)) - strictId(InvB(first)) - strictId(In(first)) - strictId(InB(first)) - strictId(Out(first)) - strictId(OutB(first)) - strictId(Inv(Inv(Inv(first)))) - - strictSelect(Inv(first), Inv(first)) - strictSelect(InvB(first), InvB(first)) - - strictSelect(Out(first), Out(bound)) - strictSelect(OutB(first), OutB(bound)) - strictSelect(In(first), In(bound)) - strictSelect(InB(first), InB(bound)) - - val out: Out = strictSelect(Out(first), Out(second)) - val outb: OutB = strictSelect(OutB(first), OutB(second)) - strictSelect>(Out(first), Out(second)) - strictSelect>(OutB(first), OutB(second)) -} - -fun testFail(first: First, bound: Bound, second: Second) { - strictSelect(InvB(first), InvB(bound)) - strictSelect(Inv(first), Inv(bound)) - strictSelect(Out(first), Out(second)) - strictSelect(In(first), In(second)) - strictSelect(InB(first), InB(second)) - strictSelect(Out(Inv(first)), Out(Inv(second))) - strictSelect(In(Inv(first)), In(Inv(second))) -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.kt index f6665db1914..5d1ce6b2c96 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/onlyInputTypesCommonConstraintSystem.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")