Get rid of originalToVariableSubstitutor and descriptorToVariable

Move the composite substitutor to GenericCandidateResolver where it was used,
other places don't need it since they know the exact call (or NO_CALL), the
substitutor for which should be used
This commit is contained in:
Alexander Udalov
2015-11-11 21:29:44 +03:00
parent cb05a8d58d
commit d4664af4e5
7 changed files with 74 additions and 52 deletions
@@ -118,17 +118,14 @@ class FuzzyType(
val builder = ConstraintSystemBuilderImpl()
val typeVariableSubstitutor = builder.registerTypeVariables(CallHandle.NONE, freeParameters + otherType.freeParameters)
val typeInSystem = typeVariableSubstitutor.substitute(type, Variance.INVARIANT)
val otherTypeInSystem = typeVariableSubstitutor.substitute(otherType.type, Variance.INVARIANT)
when (matchKind) {
MatchKind.IS_SUBTYPE -> builder.addSubtypeConstraint(
typeVariableSubstitutor.substitute(type, Variance.INVARIANT),
otherType.type,
ConstraintPositionKind.RECEIVER_POSITION.position()
)
MatchKind.IS_SUPERTYPE -> builder.addSubtypeConstraint(
typeVariableSubstitutor.substitute(otherType.type, Variance.INVARIANT),
type,
ConstraintPositionKind.RECEIVER_POSITION.position()
)
MatchKind.IS_SUBTYPE ->
builder.addSubtypeConstraint(typeInSystem, otherTypeInSystem, ConstraintPositionKind.RECEIVER_POSITION.position())
MatchKind.IS_SUPERTYPE ->
builder.addSubtypeConstraint(otherTypeInSystem, typeInSystem, ConstraintPositionKind.RECEIVER_POSITION.position())
}
builder.fixVariables()