K2: Don't lose constraint errors in the builder inference session
Pass constraint errors from the integration system into a candidate to make sure it is reported later. Related to KT-59426, KT-59437, KT-53749 #KT-55168 Submitted
This commit is contained in:
committed by
Space Team
parent
cb3d65f669
commit
2f367b013a
+32
-8
@@ -8,28 +8,52 @@ package org.jetbrains.kotlin.fir.resolve.inference.model
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.types.ConeTypeVariable
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeProjection
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.*
|
||||
import org.jetbrains.kotlin.types.model.TypeVariableMarker
|
||||
|
||||
class ConeDeclaredUpperBoundConstraintPosition : DeclaredUpperBoundConstraintPosition<Nothing?>(null)
|
||||
class ConeDeclaredUpperBoundConstraintPosition : DeclaredUpperBoundConstraintPosition<Nothing?>(null) {
|
||||
override fun toString(): String = "DeclaredUpperBound"
|
||||
}
|
||||
|
||||
class ConeFixVariableConstraintPosition(variable: TypeVariableMarker) : FixVariableConstraintPosition<Nothing?>(variable, null)
|
||||
class ConeFixVariableConstraintPosition(variable: TypeVariableMarker) : FixVariableConstraintPosition<Nothing?>(variable, null) {
|
||||
override fun toString(): String = "Fix variable ${(variable as ConeTypeVariable).typeConstructor.name}"
|
||||
}
|
||||
|
||||
class ConeArgumentConstraintPosition(argument: FirElement) : ArgumentConstraintPosition<FirElement>(argument)
|
||||
class ConeArgumentConstraintPosition(argument: FirElement) : ArgumentConstraintPosition<FirElement>(argument) {
|
||||
override fun toString(): String {
|
||||
return "Argument ${argument.render()}"
|
||||
}
|
||||
}
|
||||
|
||||
object ConeExpectedTypeConstraintPosition : ExpectedTypeConstraintPosition<Nothing?>(null)
|
||||
object ConeExpectedTypeConstraintPosition : ExpectedTypeConstraintPosition<Nothing?>(null) {
|
||||
override fun toString(): String = "ExpectedType for some call"
|
||||
}
|
||||
|
||||
class ConeExplicitTypeParameterConstraintPosition(
|
||||
typeArgument: FirTypeProjection,
|
||||
) : ExplicitTypeParameterConstraintPosition<FirTypeProjection>(typeArgument)
|
||||
) : ExplicitTypeParameterConstraintPosition<FirTypeProjection>(typeArgument) {
|
||||
override fun toString(): String = "TypeParameter ${typeArgument.render()}"
|
||||
}
|
||||
|
||||
class ConeLambdaArgumentConstraintPosition(
|
||||
anonymousFunction: FirAnonymousFunction
|
||||
) : LambdaArgumentConstraintPosition<FirAnonymousFunction>(anonymousFunction)
|
||||
) : LambdaArgumentConstraintPosition<FirAnonymousFunction>(anonymousFunction) {
|
||||
override fun toString(): String {
|
||||
return "LambdaArgument"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ConeBuilderInferenceSubstitutionConstraintPosition(initialConstraint: InitialConstraint) :
|
||||
BuilderInferenceSubstitutionConstraintPosition<Nothing?>(null, initialConstraint) // TODO
|
||||
BuilderInferenceSubstitutionConstraintPosition<Nothing?>(null, initialConstraint) {
|
||||
override fun toString(): String = "Incorporated builder inference constraint $initialConstraint " +
|
||||
"into some call"
|
||||
}
|
||||
|
||||
class ConeReceiverConstraintPosition(receiver: FirExpression) : ReceiverConstraintPosition<FirExpression>(receiver)
|
||||
class ConeReceiverConstraintPosition(receiver: FirExpression) : ReceiverConstraintPosition<FirExpression>(receiver) {
|
||||
override fun toString(): String = "Receiver ${argument.render()}"
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user