diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/Renderers.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/Renderers.java index d8271ecb495..140343a8444 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/Renderers.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/Renderers.java @@ -170,7 +170,7 @@ public class Renderers { public static TabledDescriptorRenderer renderConflictingSubstitutionsInferenceError(InferenceErrorData inferenceErrorData, TabledDescriptorRenderer result) { - assert inferenceErrorData.constraintsSystem.hasConflictingParameters(); + assert inferenceErrorData.constraintsSystem.hasConflictingConstraints(); Collection substitutedDescriptors = Lists.newArrayList(); Collection substitutors = ConstraintsUtil.getSubstitutorsForConflictingParameters( diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java index ee108c32cc4..097aac13dd0 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/CallResolver.java @@ -394,7 +394,7 @@ public class CallResolver { if (inferenceErrorData.constraintsSystem.hasTypeConstructorMismatch()) { 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)); } else { @@ -760,7 +760,7 @@ public class CallResolver { // Solution - if (!constraintsSystem.hasContradiction()) { + if (!constraintsSystem.hasTypeConstructorMismatch() && !constraintsSystem.hasConflictingConstraints()) { //no contradiction candidateCall.setHasUnknownTypeParameters(true); return SUCCESS; } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystemImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystemImpl.java index 84bf447f799..e358050b96b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystemImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystemImpl.java @@ -87,8 +87,8 @@ public class ConstraintsSystemImpl implements ConstraintsSystem { } @Override - public void registerTypeVariable(@NotNull TypeParameterDescriptor typeParameterDescriptor, @NotNull Variance positionVariance) { - typeParameterConstraints.put(typeParameterDescriptor, new TypeConstraintsImpl(positionVariance)); + public void registerTypeVariable(@NotNull TypeParameterDescriptor typeVariable, @NotNull Variance positionVariance) { + typeParameterConstraints.put(typeVariable, new TypeConstraintsImpl(positionVariance)); } @NotNull @@ -198,22 +198,17 @@ public class ConstraintsSystemImpl implements ConstraintsSystem { @Override @Nullable - public TypeConstraints getTypeConstraints(@NotNull TypeParameterDescriptor typeParameterDescriptor) { - return typeParameterConstraints.get(typeParameterDescriptor); + public TypeConstraints getTypeConstraints(@NotNull TypeParameterDescriptor typeVariable) { + return typeParameterConstraints.get(typeVariable); } @Override public boolean isSuccessful() { - return !hasTypeConstructorMismatch() && !hasUnknownParameters() && !hasConflictingParameters(); + return !hasTypeConstructorMismatch() && !hasUnknownParameters() && !hasConflictingConstraints(); } @Override - public boolean hasContradiction() { - return hasTypeConstructorMismatch() || hasConflictingParameters(); - } - - @Override - public boolean hasConflictingParameters() { + public boolean hasConflictingConstraints() { for (TypeParameterDescriptor typeParameter : typeParameterConstraints.keySet()) { TypeConstraints typeConstraints = getTypeConstraints(typeParameter); if (typeConstraints != null && ConstraintsUtil.getValues(typeConstraints).size() > 1) return true;