From d2c65b85299c00238a52c5efc23ee489aa8b201f Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Thu, 19 Jul 2012 15:38:37 +0400 Subject: [PATCH] rename --- .../lang/diagnostics/rendering/Renderers.java | 18 ++++----- .../jet/lang/resolve/calls/CallResolver.java | 40 +++++++++---------- .../lang/resolve/calls/ResolutionTask.java | 17 ++++---- .../lang/resolve/calls/ResolvedCallImpl.java | 12 +++--- ...aintsSystem.java => ConstraintSystem.java} | 2 +- ...temImpl.java => ConstraintSystemImpl.java} | 8 ++-- .../calls/inference/ConstraintsUtil.java | 34 ++++++++-------- .../calls/inference/InferenceErrorData.java | 14 +++---- .../expressions/ExpressionTypingUtils.java | 8 ++-- 9 files changed, 76 insertions(+), 77 deletions(-) rename compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/{ConstraintsSystem.java => ConstraintSystem.java} (99%) rename compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/{ConstraintsSystemImpl.java => ConstraintSystemImpl.java} (97%) 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 223d2032f79..b73251c1f73 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,17 +170,17 @@ public class Renderers { public static TabledDescriptorRenderer renderConflictingSubstitutionsInferenceError(InferenceErrorData inferenceErrorData, TabledDescriptorRenderer result) { - assert inferenceErrorData.constraintsSystem.hasConflictingConstraints(); + assert inferenceErrorData.constraintSystem.hasConflictingConstraints(); Collection substitutedDescriptors = Lists.newArrayList(); Collection substitutors = ConstraintsUtil.getSubstitutorsForConflictingParameters( - inferenceErrorData.constraintsSystem); + inferenceErrorData.constraintSystem); for (TypeSubstitutor substitutor : substitutors) { CallableDescriptor substitutedDescriptor = inferenceErrorData.descriptor.substitute(substitutor); substitutedDescriptors.add(substitutedDescriptor); } - TypeParameterDescriptor firstConflictingParameter = ConstraintsUtil.getFirstConflictingParameter(inferenceErrorData.constraintsSystem); + TypeParameterDescriptor firstConflictingParameter = ConstraintsUtil.getFirstConflictingParameter(inferenceErrorData.constraintSystem); assert firstConflictingParameter != null; result.text(newText() @@ -232,7 +232,7 @@ public class Renderers { @Override public boolean apply(@Nullable ConstraintPosition constraintPosition) { assert constraintPosition != null; - return inferenceErrorData.constraintsSystem.hasTypeConstructorMismatchAt(constraintPosition); + return inferenceErrorData.constraintSystem.hasTypeConstructorMismatchAt(constraintPosition); } }; return renderer.table(TabledDescriptorRenderer.newTable() @@ -247,8 +247,8 @@ public class Renderers { public static TabledDescriptorRenderer renderNoInformationForParameterError(InferenceErrorData inferenceErrorData, TabledDescriptorRenderer renderer) { TypeParameterDescriptor firstUnknownParameter = null; - for (TypeParameterDescriptor typeParameter : inferenceErrorData.constraintsSystem.getTypeVariables()) { - if (inferenceErrorData.constraintsSystem.getTypeConstraints(typeParameter).isEmpty()) { + for (TypeParameterDescriptor typeParameter : inferenceErrorData.constraintSystem.getTypeVariables()) { + if (inferenceErrorData.constraintSystem.getTypeConstraints(typeParameter).isEmpty()) { firstUnknownParameter = typeParameter; break; } @@ -267,7 +267,7 @@ public class Renderers { public static TabledDescriptorRenderer renderUpperBoundViolatedInferenceError(InferenceErrorData inferenceErrorData, TabledDescriptorRenderer result) { TypeParameterDescriptor typeParameterDescriptor = null; for (TypeParameterDescriptor typeParameter : inferenceErrorData.descriptor.getTypeParameters()) { - if (!ConstraintsUtil.checkUpperBoundIsSatisfied(inferenceErrorData.constraintsSystem, typeParameter)) { + if (!ConstraintsUtil.checkUpperBoundIsSatisfied(inferenceErrorData.constraintSystem, typeParameter)) { typeParameterDescriptor = typeParameter; break; } @@ -278,9 +278,9 @@ public class Renderers { .table(newTable(). descriptor(inferenceErrorData.descriptor)); - JetType type = ConstraintsUtil.getValue(inferenceErrorData.constraintsSystem.getTypeConstraints(typeParameterDescriptor)); + JetType type = ConstraintsUtil.getValue(inferenceErrorData.constraintSystem.getTypeConstraints(typeParameterDescriptor)); JetType upperBound = typeParameterDescriptor.getUpperBoundsAsType(); - JetType substitute = inferenceErrorData.constraintsSystem.getResultingSubstitutor().substitute(upperBound, Variance.INVARIANT); + JetType substitute = inferenceErrorData.constraintSystem.getResultingSubstitutor().substitute(upperBound, Variance.INVARIANT); result.text(newText() .normal(" is not satisfied: inferred type ") 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 56777fa8be8..fe11d3cf2da 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 @@ -340,10 +340,10 @@ public class CallResolver { ) { assert resolvedCall.hasUnknownTypeParameters(); D descriptor = resolvedCall.getCandidateDescriptor(); - ConstraintsSystem constraintsSystem = resolvedCall.getConstraintsSystem(); - assert constraintsSystem != null; + ConstraintSystem constraintSystem = resolvedCall.getConstraintSystem(); + assert constraintSystem != null; - constraintsSystem.addSubtypingConstraint(descriptor.getReturnType(), context.expectedType, + constraintSystem.addSubtypingConstraint(descriptor.getReturnType(), context.expectedType, ConstraintPosition.EXPECTED_TYPE_POSITION); // constraints for function literals @@ -355,23 +355,23 @@ public class CallResolver { for (ValueArgument valueArgument : resolvedValueArgument.getArguments()) { if (!JetPsiUtil.isFunctionLiteralWithoutDeclaredParameterTypes(valueArgument.getArgumentExpression())) continue; - addConstraintForValueArgument(valueArgument, valueParameterDescriptor, constraintsSystem.getCurrentSubstitutor(), - constraintsSystem, context); + addConstraintForValueArgument(valueArgument, valueParameterDescriptor, constraintSystem.getCurrentSubstitutor(), + constraintSystem, context); } } - if (!constraintsSystem.isSuccessful()) { + if (!constraintSystem.isSuccessful()) { List argumentTypes = checkValueArgumentTypes(context, resolvedCall, context.trace).argumentTypes; JetType receiverType = resolvedCall.getReceiverArgument().exists() ? resolvedCall.getReceiverArgument().getType() : null; tracing.typeInferenceFailed(context.trace, - InferenceErrorData.create(descriptor, constraintsSystem, argumentTypes, receiverType, context.expectedType)); + InferenceErrorData.create(descriptor, constraintSystem, argumentTypes, receiverType, context.expectedType)); resolvedCall.addStatus(ResolutionStatus.TYPE_INFERENCE_ERROR); failed.add(resolvedCall); return; } - D substitute = (D) descriptor.substitute(constraintsSystem.getResultingSubstitutor()); + D substitute = (D) descriptor.substitute(constraintSystem.getResultingSubstitutor()); assert substitute != null; replaceValueParametersWithSubstitutedOnes(resolvedCall, substitute); resolvedCall.setResultingDescriptor(substitute); //replacement @@ -379,7 +379,7 @@ public class CallResolver { // Here we type check the arguments with inferred types expected checkValueArgumentTypes(context, resolvedCall, context.trace); - checkBounds(resolvedCall, constraintsSystem, context.trace, tracing); + checkBounds(resolvedCall, constraintSystem, context.trace, tracing); resolvedCall.setHasUnknownTypeParameters(false); if (resolvedCall.getStatus().isSuccess() || resolvedCall.getStatus() == ResolutionStatus.UNKNOWN_STATUS) { resolvedCall.addStatus(ResolutionStatus.SUCCESS); @@ -392,13 +392,13 @@ public class CallResolver { private void checkBounds( @NotNull ResolvedCallImpl call, - @NotNull ConstraintsSystem constraintsSystem, + @NotNull ConstraintSystem constraintSystem, @NotNull BindingTrace trace, @NotNull TracingStrategy tracing ) { for (TypeParameterDescriptor typeParameter : call.getCandidateDescriptor().getTypeParameters()) { - if (!ConstraintsUtil.checkUpperBoundIsSatisfied(constraintsSystem, typeParameter)) { - tracing.upperBoundViolated(trace, InferenceErrorData.create(call.getCandidateDescriptor(), constraintsSystem)); + if (!ConstraintsUtil.checkUpperBoundIsSatisfied(constraintSystem, typeParameter)) { + tracing.upperBoundViolated(trace, InferenceErrorData.create(call.getCandidateDescriptor(), constraintSystem)); } } } @@ -693,7 +693,7 @@ public class CallResolver { ResolutionDebugInfo.Data debugInfo = context.trace.get(ResolutionDebugInfo.RESOLUTION_DEBUG_INFO, context.call.getCallElement()); - ConstraintsSystemImpl constraintsSystem = new ConstraintsSystemImpl(); + ConstraintSystemImpl constraintsSystem = new ConstraintSystemImpl(); // If the call is recursive, e.g. // fun foo(t : T) : T = foo(t) @@ -709,7 +709,7 @@ public class CallResolver { } TypeSubstitutor substituteDontCare = ConstraintSystemWithPriorities - .makeConstantSubstitutor(candidateWithFreshVariables.getTypeParameters(), ConstraintsSystemImpl.DONT_CARE); + .makeConstantSubstitutor(candidateWithFreshVariables.getTypeParameters(), ConstraintSystemImpl.DONT_CARE); // Value parameters for (Map.Entry entry : candidateCall.getValueArguments().entrySet()) { @@ -746,8 +746,8 @@ public class CallResolver { typeVariablesMap.put(candidateWithFreshVariables.getTypeParameters().get(typeParameterDescriptor.getIndex()), typeParameterDescriptor); } - ConstraintsSystem constraintsBuilderWithRightTypeParameters = constraintsSystem.replaceTypeVariables(typeVariablesMap); - candidateCall.setConstraintsSystem(constraintsBuilderWithRightTypeParameters); + ConstraintSystem constraintBuilderWithRightTypeParameters = constraintsSystem.replaceTypeVariables(typeVariablesMap); + candidateCall.setConstraintSystem(constraintBuilderWithRightTypeParameters); // Solution @@ -761,7 +761,7 @@ public class CallResolver { List argumentTypes = checkingResult.argumentTypes; JetType receiverType = candidateCall.getReceiverArgument().exists() ? candidateCall.getReceiverArgument().getType() : null; context.tracing.typeInferenceFailed(context.trace, - InferenceErrorData.create(candidate, constraintsBuilderWithRightTypeParameters, argumentTypes, receiverType, context.expectedType)); + InferenceErrorData.create(candidate, constraintBuilderWithRightTypeParameters, argumentTypes, receiverType, context.expectedType)); return TYPE_INFERENCE_ERROR.combine(argumentsStatus); } } @@ -769,7 +769,7 @@ public class CallResolver { private boolean addConstraintForValueArgument(ValueArgument valueArgument, @NotNull ValueParameterDescriptor valueParameterDescriptor, @NotNull TypeSubstitutor substitutor, - @NotNull ConstraintsSystem constraintsSystem, + @NotNull ConstraintSystem constraintSystem, @NotNull ResolutionContext context) { JetType effectiveExpectedType = getEffectiveExpectedType(valueParameterDescriptor, valueArgument); @@ -778,7 +778,7 @@ public class CallResolver { JetType type = argumentExpression != null ? expressionTypingServices.getType( context.scope, argumentExpression, substitutor.substitute(valueParameterDescriptor.getType(), Variance.INVARIANT), context.dataFlowInfo, traceForUnknown) : null; - constraintsSystem.addSupertypeConstraint(effectiveExpectedType, type, ConstraintPosition.getValueParameterPosition( + constraintSystem.addSupertypeConstraint(effectiveExpectedType, type, ConstraintPosition.getValueParameterPosition( valueParameterDescriptor.getIndex())); //todo no return if (type == null || ErrorUtils.isErrorType(type)) return false; @@ -977,7 +977,7 @@ public class CallResolver { if (argument.getSpreadElement() != null) { if (parameterDescriptor.getVarargElementType() == null) { // Spread argument passed to a non-vararg parameter, an error is already reported by ValueArgumentsToParametersMapper - return ConstraintsSystemImpl.DONT_CARE; + return ConstraintSystemImpl.DONT_CARE; } else { return parameterDescriptor.getType(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionTask.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionTask.java index 9645ef18020..7804c280e0b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionTask.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolutionTask.java @@ -27,8 +27,7 @@ import org.jetbrains.jet.lang.diagnostics.Errors; import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.resolve.BindingTrace; import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo; -import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintPosition; -import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintsSystem; +import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintSystem; import org.jetbrains.jet.lang.resolve.calls.inference.InferenceErrorData; import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.scopes.JetScope; @@ -236,24 +235,24 @@ public class ResolutionTask extends R @Override public void typeInferenceFailed(@NotNull BindingTrace trace, @NotNull InferenceErrorData data) { - ConstraintsSystem constraintsSystem = data.constraintsSystem; - assert !constraintsSystem.isSuccessful(); - if (constraintsSystem.hasErrorInConstrainingTypes()) { + ConstraintSystem constraintSystem = data.constraintSystem; + assert !constraintSystem.isSuccessful(); + if (constraintSystem.hasErrorInConstrainingTypes()) { return; } - if (constraintsSystem.hasExpectedTypeMismatch()) { + if (constraintSystem.hasExpectedTypeMismatch()) { JetType returnType = data.descriptor.getReturnType(); assert returnType != null; trace.report(TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH.on(reference, returnType, data.expectedType)); } - else if (constraintsSystem.hasTypeConstructorMismatch()) { + else if (constraintSystem.hasTypeConstructorMismatch()) { trace.report(TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH.on(reference, data)); } - else if (constraintsSystem.hasConflictingConstraints()) { + else if (constraintSystem.hasConflictingConstraints()) { trace.report(TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS.on(reference, data)); } else { - assert constraintsSystem.hasUnknownParameters(); + assert constraintSystem.hasUnknownParameters(); trace.report(TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER.on(reference, data)); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolvedCallImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolvedCallImpl.java index 387e88b7e05..0261d475809 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolvedCallImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/ResolvedCallImpl.java @@ -24,7 +24,7 @@ import org.jetbrains.jet.lang.descriptors.CallableDescriptor; import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor; import org.jetbrains.jet.lang.descriptors.ValueParameterDescriptor; import org.jetbrains.jet.lang.resolve.TemporaryBindingTrace; -import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintsSystem; +import org.jetbrains.jet.lang.resolve.calls.inference.ConstraintSystem; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.jetbrains.jet.lang.types.JetType; @@ -72,7 +72,7 @@ public class ResolvedCallImpl implements ResolvedC private TemporaryBindingTrace trace; private ResolutionStatus status = UNKNOWN_STATUS; private boolean hasUnknownTypeParameters = false; - private ConstraintsSystem constraintsSystem = null; + private ConstraintSystem constraintSystem = null; private ResolvedCallImpl(@NotNull ResolutionCandidate candidate, @NotNull TemporaryBindingTrace trace) { this.candidateDescriptor = candidate.getDescriptor(); @@ -130,13 +130,13 @@ public class ResolvedCallImpl implements ResolvedC typeArguments.put(typeParameter, typeArgument); } - public void setConstraintsSystem(@NotNull ConstraintsSystem constraintsSystem) { - this.constraintsSystem = constraintsSystem; + public void setConstraintSystem(@NotNull ConstraintSystem constraintSystem) { + this.constraintSystem = constraintSystem; } @Nullable - public ConstraintsSystem getConstraintsSystem() { - return constraintsSystem; + public ConstraintSystem getConstraintSystem() { + return constraintSystem; } public void recordValueArgument(@NotNull ValueParameterDescriptor valueParameter, @NotNull ResolvedValueArgument valueArgument) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystem.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystem.java similarity index 99% rename from compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystem.java rename to compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystem.java index 6002c6d0048..e369e975945 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystem.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystem.java @@ -28,7 +28,7 @@ import java.util.Set; /** * @author svtk */ -public interface ConstraintsSystem { +public interface ConstraintSystem { /** * Registers a variable in a constraint system. 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/ConstraintSystemImpl.java similarity index 97% rename from compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsSystemImpl.java rename to compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintSystemImpl.java index 38b509f7af9..c91d7a5b86b 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/ConstraintSystemImpl.java @@ -32,7 +32,7 @@ import java.util.*; /** * @author svtk */ -public class ConstraintsSystemImpl implements ConstraintsSystem { +public class ConstraintSystemImpl implements ConstraintSystem { public static final JetType DONT_CARE = ErrorUtils.createErrorTypeWithCustomDebugName("DONT_CARE"); @@ -42,7 +42,7 @@ public class ConstraintsSystemImpl implements ConstraintsSystem { private final TypeSubstitutor currentSubstitutor; private boolean hasErrorInConstrainingTypes; - public ConstraintsSystemImpl() { + public ConstraintSystemImpl() { this.resultingSubstitutor = createTypeSubstitutorWithDefaultForUnknownTypeParameter(null); this.currentSubstitutor = createTypeSubstitutorWithDefaultForUnknownTypeParameter(new TypeProjection(DONT_CARE)); } @@ -105,8 +105,8 @@ public class ConstraintsSystemImpl implements ConstraintsSystem { } @NotNull - public ConstraintsSystemImpl replaceTypeVariables(@NotNull Map typeVariablesMap) { - ConstraintsSystemImpl newConstraintSystem = new ConstraintsSystemImpl(); + public ConstraintSystemImpl replaceTypeVariables(@NotNull Map typeVariablesMap) { + ConstraintSystemImpl newConstraintSystem = new ConstraintSystemImpl(); for (Map.Entry entry : typeParameterConstraints.entrySet()) { TypeParameterDescriptor typeParameter = entry.getKey(); TypeConstraintsImpl typeConstraints = entry.getValue(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsUtil.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsUtil.java index 23040edcf26..ab1cd48af82 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsUtil.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/ConstraintsUtil.java @@ -84,9 +84,9 @@ public class ConstraintsUtil { @Nullable - public static TypeParameterDescriptor getFirstConflictingParameter(@NotNull ConstraintsSystem constraintsSystem) { - for (TypeParameterDescriptor typeParameter : constraintsSystem.getTypeVariables()) { - TypeConstraints constraints = constraintsSystem.getTypeConstraints(typeParameter); + public static TypeParameterDescriptor getFirstConflictingParameter(@NotNull ConstraintSystem constraintSystem) { + for (TypeParameterDescriptor typeParameter : constraintSystem.getTypeVariables()) { + TypeConstraints constraints = constraintSystem.getTypeConstraints(typeParameter); if (getValues(constraints).size() > 1) { return typeParameter; } @@ -95,11 +95,11 @@ public class ConstraintsUtil { } @NotNull - public static Collection getSubstitutorsForConflictingParameters(@NotNull ConstraintsSystem constraintsSystem) { - TypeParameterDescriptor firstConflictingParameter = getFirstConflictingParameter(constraintsSystem); + public static Collection getSubstitutorsForConflictingParameters(@NotNull ConstraintSystem constraintSystem) { + TypeParameterDescriptor firstConflictingParameter = getFirstConflictingParameter(constraintSystem); if (firstConflictingParameter == null) return Collections.emptyList(); - Collection conflictingTypes = getValues(constraintsSystem.getTypeConstraints(firstConflictingParameter)); + Collection conflictingTypes = getValues(constraintSystem.getTypeConstraints(firstConflictingParameter)); ArrayList> substitutionContexts = Lists.newArrayList(); for (JetType type : conflictingTypes) { @@ -108,10 +108,10 @@ public class ConstraintsUtil { substitutionContexts.add(context); } - for (TypeParameterDescriptor typeParameter : constraintsSystem.getTypeVariables()) { + for (TypeParameterDescriptor typeParameter : constraintSystem.getTypeVariables()) { if (typeParameter == firstConflictingParameter) continue; - JetType safeType = getSafeValue(constraintsSystem, typeParameter); + JetType safeType = getSafeValue(constraintSystem, typeParameter); for (Map context : substitutionContexts) { TypeProjection typeProjection = new TypeProjection(safeType); context.put(typeParameter.getTypeConstructor(), typeProjection); @@ -125,8 +125,8 @@ public class ConstraintsUtil { } @NotNull - public static JetType getSafeValue(@NotNull ConstraintsSystem constraintsSystem, @NotNull TypeParameterDescriptor typeParameter) { - TypeConstraints constraints = constraintsSystem.getTypeConstraints(typeParameter); + public static JetType getSafeValue(@NotNull ConstraintSystem constraintSystem, @NotNull TypeParameterDescriptor typeParameter) { + TypeConstraints constraints = constraintSystem.getTypeConstraints(typeParameter); JetType type = getValue(constraints); if (type != null) { return type; @@ -135,13 +135,13 @@ public class ConstraintsUtil { return typeParameter.getUpperBoundsAsType(); } - public static boolean checkUpperBoundIsSatisfied(@NotNull ConstraintsSystem constraintsSystem, + public static boolean checkUpperBoundIsSatisfied(@NotNull ConstraintSystem constraintSystem, @NotNull TypeParameterDescriptor typeParameter) { - TypeConstraints typeConstraints = constraintsSystem.getTypeConstraints(typeParameter); + TypeConstraints typeConstraints = constraintSystem.getTypeConstraints(typeParameter); assert typeConstraints != null; JetType type = getValue(typeConstraints); JetType upperBound = typeParameter.getUpperBoundsAsType(); - JetType substitute = constraintsSystem.getResultingSubstitutor().substitute(upperBound, Variance.INVARIANT); + JetType substitute = constraintSystem.getResultingSubstitutor().substitute(upperBound, Variance.INVARIANT); if (type != null) { if (substitute == null || !JetTypeChecker.INSTANCE.isSubtypeOf(type, substitute)) { @@ -151,11 +151,11 @@ public class ConstraintsUtil { return true; } - public static boolean checkBoundsAreSatisfied(ConstraintsSystem constraintsSystem) { - for (TypeParameterDescriptor typeVariable : constraintsSystem.getTypeVariables()) { - JetType type = getValue(constraintsSystem.getTypeConstraints(typeVariable)); + public static boolean checkBoundsAreSatisfied(ConstraintSystem constraintSystem) { + for (TypeParameterDescriptor typeVariable : constraintSystem.getTypeVariables()) { + JetType type = getValue(constraintSystem.getTypeConstraints(typeVariable)); JetType upperBound = typeVariable.getUpperBoundsAsType(); - JetType substitutedType = constraintsSystem.getResultingSubstitutor().substitute(upperBound, Variance.INVARIANT); + JetType substitutedType = constraintSystem.getResultingSubstitutor().substitute(upperBound, Variance.INVARIANT); if (type != null) { if (substitutedType == null || !JetTypeChecker.INSTANCE.isSubtypeOf(type, substitutedType)) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/InferenceErrorData.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/InferenceErrorData.java index b0a0d78b2f5..730d5f8b2f3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/InferenceErrorData.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/calls/inference/InferenceErrorData.java @@ -29,27 +29,27 @@ import java.util.List; */ public class InferenceErrorData { public final CallableDescriptor descriptor; - public final ConstraintsSystem constraintsSystem; + public final ConstraintSystem constraintSystem; public final JetType receiverArgumentType; public final JetType expectedType; public final List valueArgumentsTypes; - private InferenceErrorData(@NotNull CallableDescriptor descriptor, @NotNull ConstraintsSystem constraintsSystem, + private InferenceErrorData(@NotNull CallableDescriptor descriptor, @NotNull ConstraintSystem constraintSystem, @Nullable List valueArgumentsTypes, @Nullable JetType receiverArgumentType, @Nullable JetType expectedType) { this.descriptor = descriptor; - this.constraintsSystem = constraintsSystem; + this.constraintSystem = constraintSystem; this.receiverArgumentType = receiverArgumentType; this.valueArgumentsTypes = valueArgumentsTypes; this.expectedType = expectedType; } - public static InferenceErrorData create(@NotNull CallableDescriptor descriptor, @NotNull ConstraintsSystem constraintsSystem, + public static InferenceErrorData create(@NotNull CallableDescriptor descriptor, @NotNull ConstraintSystem constraintSystem, @NotNull List valueArgumentsTypes, @Nullable JetType receiverArgumentType, @Nullable JetType expectedType) { - return new InferenceErrorData(descriptor, constraintsSystem, valueArgumentsTypes, receiverArgumentType, + return new InferenceErrorData(descriptor, constraintSystem, valueArgumentsTypes, receiverArgumentType, expectedType != TypeUtils.NO_EXPECTED_TYPE ? expectedType : null); } - public static InferenceErrorData create(@NotNull CallableDescriptor descriptor, @NotNull ConstraintsSystem constraintsSystem) { - return new InferenceErrorData(descriptor, constraintsSystem, null, null, null); + public static InferenceErrorData create(@NotNull CallableDescriptor descriptor, @NotNull ConstraintSystem constraintSystem) { + return new InferenceErrorData(descriptor, constraintSystem, null, null, null); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java index 41e811aaa5a..3f0de1255b3 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/ExpressionTypingUtils.java @@ -232,20 +232,20 @@ public class ExpressionTypingUtils { @NotNull JetType receiverType, @NotNull CallableDescriptor receiverArgument ) { - ConstraintsSystem constraintsSystem = new ConstraintsSystemImpl(); + ConstraintSystem constraintSystem = new ConstraintSystemImpl(); for (TypeParameterDescriptor typeParameterDescriptor : receiverArgument.getTypeParameters()) { - constraintsSystem.registerTypeVariable(typeParameterDescriptor, Variance.INVARIANT); + constraintSystem.registerTypeVariable(typeParameterDescriptor, Variance.INVARIANT); } ReceiverDescriptor receiverParameter = receiverArgument.getReceiverParameter(); if (expectedReceiver.exists() && receiverParameter.exists()) { - constraintsSystem.addSupertypeConstraint(receiverParameter.getType(), receiverType, ConstraintPosition.RECEIVER_POSITION); + constraintSystem.addSupertypeConstraint(receiverParameter.getType(), receiverType, ConstraintPosition.RECEIVER_POSITION); } else if (expectedReceiver.exists() || receiverParameter.exists()) { // Only one of receivers exist return false; } - return constraintsSystem.isSuccessful() && ConstraintsUtil.checkBoundsAreSatisfied(constraintsSystem); + return constraintSystem.isSuccessful() && ConstraintsUtil.checkBoundsAreSatisfied(constraintSystem); } }