Introduce specific error for calls which could be resolved only with unrestricted builder inference

^KT-47747 Fixed
This commit is contained in:
Victor Petukhov
2021-07-15 12:57:31 +03:00
committed by teamcityserver
parent 357fda2efa
commit 6a1ec92d39
15 changed files with 38 additions and 11 deletions
@@ -148,6 +148,7 @@ class PostponedArgumentsAnalyzer(
if (hasInapplicableCallForBuilderInference) {
inferenceSession?.initializeLambda(lambda)
c.getBuilder().markCouldBeResolvedWithUnrestrictedBuilderInference()
c.getBuilder().removePostponedVariables()
return
}
@@ -316,7 +316,9 @@ class KotlinConstraintSystemCompleter(
val resolvedAtom = findResolvedAtomBy(typeVariable, topLevelAtoms) ?: topLevelAtoms.firstOrNull()
if (resolvedAtom != null) {
c.addError(NotEnoughInformationForTypeParameterImpl(typeVariable, resolvedAtom))
c.addError(
NotEnoughInformationForTypeParameterImpl(typeVariable, resolvedAtom, c.couldBeResolvedWithUnrestrictedBuilderInference())
)
}
val resultErrorType = when {
@@ -54,5 +54,6 @@ class DelegatedPropertyConstraintPositionImpl(topLevelCall: KotlinCall) : Delega
class NotEnoughInformationForTypeParameterImpl(
typeVariable: TypeVariableMarker,
resolvedAtom: ResolvedAtom
) : NotEnoughInformationForTypeParameter<ResolvedAtom>(typeVariable, resolvedAtom)
resolvedAtom: ResolvedAtom,
couldBeResolvedWithUnrestrictedBuilderInference: Boolean
) : NotEnoughInformationForTypeParameter<ResolvedAtom>(typeVariable, resolvedAtom, couldBeResolvedWithUnrestrictedBuilderInference)