K2: implement BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION

#KT-59390 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-11-29 08:09:41 +01:00
committed by Space Team
parent 299d279915
commit 526bc1744a
25 changed files with 219 additions and 23 deletions
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability
import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability.*
import org.jetbrains.kotlin.types.EmptyIntersectionTypeKind
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.kotlin.types.model.TypeParameterMarker
import org.jetbrains.kotlin.types.model.TypeVariableMarker
interface OnlyInputTypeConstraintPosition
@@ -173,6 +174,11 @@ class OnlyInputTypesDiagnostic(val typeVariable: TypeVariableMarker) : Constrain
class LowerPriorityToPreserveCompatibility(val needToReportWarning: Boolean) :
ConstraintSystemError(RESOLVED_NEED_PRESERVE_COMPATIBILITY)
open class MultiLambdaBuilderInferenceRestriction<T>(
val anonymous: T,
val typeParameter: TypeParameterMarker
) : ConstraintSystemError(RESOLVED_WITH_ERROR)
fun Constraint.isExpectedTypePosition() =
position.from is ExpectedTypeConstraintPosition<*> || position.from is DelegatedPropertyConstraintPosition<*>