new constraint system instead of old is used

This commit is contained in:
Svetlana Isakova
2012-07-03 13:22:36 +04:00
parent 1df826093a
commit e77cc82afd
@@ -232,21 +232,20 @@ public class ExpressionTypingUtils {
@NotNull JetType receiverType, @NotNull JetType receiverType,
@NotNull CallableDescriptor receiverArgument @NotNull CallableDescriptor receiverArgument
) { ) {
ConstraintSystem constraintSystem = new ConstraintSystemWithPriorities(ConstraintResolutionListener.DO_NOTHING); ConstraintSystemImpl constraintSystem = new ConstraintSystemImpl();
for (TypeParameterDescriptor typeParameterDescriptor : receiverArgument.getTypeParameters()) { for (TypeParameterDescriptor typeParameterDescriptor : receiverArgument.getTypeParameters()) {
constraintSystem.registerTypeVariable(typeParameterDescriptor, Variance.INVARIANT); constraintSystem.registerTypeVariable(typeParameterDescriptor, Variance.INVARIANT);
} }
ReceiverDescriptor receiverParameter = receiverArgument.getReceiverParameter(); ReceiverDescriptor receiverParameter = receiverArgument.getReceiverParameter();
if (expectedReceiver.exists() && receiverParameter.exists()) { if (expectedReceiver.exists() && receiverParameter.exists()) {
constraintSystem.addSubtypingConstraint(ConstraintType.RECEIVER.assertSubtyping(receiverType, receiverParameter.getType())); constraintSystem.addSubtypingConstraint(receiverType, receiverParameter.getType());
} }
else if (expectedReceiver.exists() || receiverParameter.exists()) { else if (expectedReceiver.exists() || receiverParameter.exists()) {
// Only one of receivers exist // Only one of receivers exist
return false; return false;
} }
ConstraintSystemSolution solution = constraintSystem.solve(); return constraintSystem.isSuccessful() && constraintSystem.upperBoundsAreSatisfied();
return solution.getStatus().isSuccessful();
} }
} }