[NI] Make constraint check for type variables with complex dependency
Additional check for trivial constraints is needed to make lambda analysis before outer variable fixation to Nothing(?) ^KT-37627 Fixed
This commit is contained in:
+2
-3
@@ -214,10 +214,9 @@ class KotlinConstraintSystemCompleter(
|
||||
val expectedTypeVariable =
|
||||
expectedTypeAtom?.constructor?.takeIf { it in allTypeVariables } ?: variable
|
||||
|
||||
val shouldAnalyzeByEqualityExpectedTypeToVariable =
|
||||
hasProperAtom || !variableForFixation.hasProperConstraint || variableForFixation.hasOnlyTrivialProperConstraint
|
||||
val shouldAnalyze = hasProperAtom || !variableForFixation.hasProperConstraint || variableForFixation.hasOnlyTrivialProperConstraint
|
||||
|
||||
if (!shouldAnalyzeByEqualityExpectedTypeToVariable)
|
||||
if (!shouldAnalyze)
|
||||
return false
|
||||
|
||||
analyze(preparePostponedAtom(expectedTypeVariable, postponedAtom, variable.builtIns, diagnosticsHolder) ?: return false)
|
||||
|
||||
+6
@@ -114,6 +114,12 @@ class VariableFixationFinder(
|
||||
return when (candidateReadiness) {
|
||||
TypeVariableFixationReadiness.FORBIDDEN -> null
|
||||
TypeVariableFixationReadiness.WITHOUT_PROPER_ARGUMENT_CONSTRAINT -> VariableForFixation(candidate, false)
|
||||
TypeVariableFixationReadiness.WITH_COMPLEX_DEPENDENCY_UPPER,
|
||||
TypeVariableFixationReadiness.WITH_COMPLEX_DEPENDENCY_LOWER -> VariableForFixation(
|
||||
candidate,
|
||||
hasProperConstraint = variableHasProperArgumentConstraints(candidate),
|
||||
hasOnlyTrivialProperConstraint = variableHasTrivialOrNonProperConstraints(candidate)
|
||||
)
|
||||
TypeVariableFixationReadiness.WITH_TRIVIAL_OR_NON_PROPER_CONSTRAINTS ->
|
||||
VariableForFixation(candidate, hasProperConstraint = true, hasOnlyTrivialProperConstraint = true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user