removed method hasContradiction() from ConstraintSystem interface

rename
This commit is contained in:
Svetlana Isakova
2012-07-18 14:44:09 +04:00
parent 63ad4dbd17
commit 4d281a40c8
3 changed files with 9 additions and 14 deletions
@@ -170,7 +170,7 @@ public class Renderers {
public static TabledDescriptorRenderer renderConflictingSubstitutionsInferenceError(InferenceErrorData inferenceErrorData, public static TabledDescriptorRenderer renderConflictingSubstitutionsInferenceError(InferenceErrorData inferenceErrorData,
TabledDescriptorRenderer result) { TabledDescriptorRenderer result) {
assert inferenceErrorData.constraintsSystem.hasConflictingParameters(); assert inferenceErrorData.constraintsSystem.hasConflictingConstraints();
Collection<CallableDescriptor> substitutedDescriptors = Lists.newArrayList(); Collection<CallableDescriptor> substitutedDescriptors = Lists.newArrayList();
Collection<TypeSubstitutor> substitutors = ConstraintsUtil.getSubstitutorsForConflictingParameters( Collection<TypeSubstitutor> substitutors = ConstraintsUtil.getSubstitutorsForConflictingParameters(
@@ -394,7 +394,7 @@ public class CallResolver {
if (inferenceErrorData.constraintsSystem.hasTypeConstructorMismatch()) { if (inferenceErrorData.constraintsSystem.hasTypeConstructorMismatch()) {
trace.report(TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH.on(element, inferenceErrorData)); trace.report(TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH.on(element, inferenceErrorData));
} }
else if (inferenceErrorData.constraintsSystem.hasConflictingParameters()) { else if (inferenceErrorData.constraintsSystem.hasConflictingConstraints()) {
trace.report(TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS.on(element, inferenceErrorData)); trace.report(TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS.on(element, inferenceErrorData));
} }
else { else {
@@ -760,7 +760,7 @@ public class CallResolver {
// Solution // Solution
if (!constraintsSystem.hasContradiction()) { if (!constraintsSystem.hasTypeConstructorMismatch() && !constraintsSystem.hasConflictingConstraints()) { //no contradiction
candidateCall.setHasUnknownTypeParameters(true); candidateCall.setHasUnknownTypeParameters(true);
return SUCCESS; return SUCCESS;
} }
@@ -87,8 +87,8 @@ public class ConstraintsSystemImpl implements ConstraintsSystem {
} }
@Override @Override
public void registerTypeVariable(@NotNull TypeParameterDescriptor typeParameterDescriptor, @NotNull Variance positionVariance) { public void registerTypeVariable(@NotNull TypeParameterDescriptor typeVariable, @NotNull Variance positionVariance) {
typeParameterConstraints.put(typeParameterDescriptor, new TypeConstraintsImpl(positionVariance)); typeParameterConstraints.put(typeVariable, new TypeConstraintsImpl(positionVariance));
} }
@NotNull @NotNull
@@ -198,22 +198,17 @@ public class ConstraintsSystemImpl implements ConstraintsSystem {
@Override @Override
@Nullable @Nullable
public TypeConstraints getTypeConstraints(@NotNull TypeParameterDescriptor typeParameterDescriptor) { public TypeConstraints getTypeConstraints(@NotNull TypeParameterDescriptor typeVariable) {
return typeParameterConstraints.get(typeParameterDescriptor); return typeParameterConstraints.get(typeVariable);
} }
@Override @Override
public boolean isSuccessful() { public boolean isSuccessful() {
return !hasTypeConstructorMismatch() && !hasUnknownParameters() && !hasConflictingParameters(); return !hasTypeConstructorMismatch() && !hasUnknownParameters() && !hasConflictingConstraints();
} }
@Override @Override
public boolean hasContradiction() { public boolean hasConflictingConstraints() {
return hasTypeConstructorMismatch() || hasConflictingParameters();
}
@Override
public boolean hasConflictingParameters() {
for (TypeParameterDescriptor typeParameter : typeParameterConstraints.keySet()) { for (TypeParameterDescriptor typeParameter : typeParameterConstraints.keySet()) {
TypeConstraints typeConstraints = getTypeConstraints(typeParameter); TypeConstraints typeConstraints = getTypeConstraints(typeParameter);
if (typeConstraints != null && ConstraintsUtil.getValues(typeConstraints).size() > 1) return true; if (typeConstraints != null && ConstraintsUtil.getValues(typeConstraints).size() > 1) return true;