[NI] Remove direcion calculator from variable fixation
Force constraint system completer to always fix variable with unknown position. This makes inferred type for in parameters less specific, but OI infers to subtype in such cases, so NI won't infer to less specific types than before.
This commit is contained in:
+2
-5
@@ -89,7 +89,7 @@ class KotlinConstraintSystemCompleter(
|
||||
val variableWithConstraints = c.notFixedTypeVariables.getValue(variableForFixation.variable)
|
||||
|
||||
if (variableForFixation.hasProperConstraint)
|
||||
fixVariable(c, topLevelType, variableWithConstraints, postponedKtPrimitives, topLevelAtoms)
|
||||
fixVariable(c, variableWithConstraints, topLevelAtoms)
|
||||
else
|
||||
processVariableWhenNotEnoughInformation(c, variableWithConstraints, topLevelAtoms)
|
||||
|
||||
@@ -206,13 +206,10 @@ class KotlinConstraintSystemCompleter(
|
||||
|
||||
private fun fixVariable(
|
||||
c: Context,
|
||||
topLevelType: UnwrappedType,
|
||||
variableWithConstraints: VariableWithConstraints,
|
||||
postponedResolveKtPrimitives: List<PostponedResolvedAtom>,
|
||||
topLevelAtoms: List<ResolvedAtom>
|
||||
) {
|
||||
val direction = TypeVariableDirectionCalculator(c, postponedResolveKtPrimitives, topLevelType).getDirection(variableWithConstraints)
|
||||
fixVariable(c, variableWithConstraints, direction, topLevelAtoms)
|
||||
fixVariable(c, variableWithConstraints, TypeVariableDirectionCalculator.ResolveDirection.UNKNOWN, topLevelAtoms)
|
||||
}
|
||||
|
||||
fun fixVariable(
|
||||
|
||||
@@ -57,14 +57,13 @@ fun test7(cls: Cls) {
|
||||
}
|
||||
|
||||
fun test8(cls: Cls) {
|
||||
// TODO
|
||||
<!IMPLICIT_NOTHING_AS_TYPE_PARAMETER, TYPE_MISMATCH!>id<!>(
|
||||
id(
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Inv<in Cls>")!>wrapIn(cls)<!>
|
||||
)
|
||||
}
|
||||
|
||||
fun test9(cls: Cls) {
|
||||
id(
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("InB<Bound>")!>InB(cls)<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("InB<Cls>")!>InB(cls)<!>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user