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
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
import org.jetbrains.kotlin.resolve.calls.inference.BuilderInferenceExpectedTypeConstraintPosition
import org.jetbrains.kotlin.resolve.calls.inference.model.*
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.calls.model.MultiLambdaBuilderInferenceRestriction
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactory
import org.jetbrains.kotlin.resolve.calls.smartcasts.SingleSmartCast
import org.jetbrains.kotlin.resolve.calls.smartcasts.SmartCastManager
@@ -55,6 +56,7 @@ import org.jetbrains.kotlin.types.model.freshTypeConstructor
import org.jetbrains.kotlin.types.typeUtil.contains
import org.jetbrains.kotlin.types.typeUtil.isNullableNothing
import org.jetbrains.kotlin.types.typeUtil.makeNullable
import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
@@ -812,7 +814,9 @@ class DiagnosticReporterByTrackingStrategy(
// LowerPriorityToPreserveCompatibility is not expected to report something
is LowerPriorityToPreserveCompatibility -> {}
// NoSuccessfulFork does not exist in K1
is NoSuccessfulFork -> {}
is NoSuccessfulFork -> shouldNotBeCalled()
// MultiLambdaBuilderInferenceRestriction does not exist in K1
is org.jetbrains.kotlin.resolve.calls.inference.model.MultiLambdaBuilderInferenceRestriction<*> -> shouldNotBeCalled()
// NotEnoughInformationForTypeParameterImpl is already considered above
is NotEnoughInformationForTypeParameter<*> -> {
throw AssertionError("constraintError should not be called with ${error::class.java}")