Resolve fake call for 'equals(Any?)' with actual right expression instead of fake one

This commit is contained in:
svtk
2013-11-11 17:51:23 +04:00
committed by Natalia Ukhorskaya
parent 1d5d5486ce
commit 32299a7b9b
2 changed files with 19 additions and 3 deletions
@@ -878,8 +878,14 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
dataFlowInfo = leftTypeInfo.getDataFlowInfo();
ExpressionTypingContext contextWithDataFlow = context.replaceDataFlowInfo(dataFlowInfo);
OverloadResolutionResults<FunctionDescriptor> resolutionResults = resolveFakeCall(
contextWithDataFlow, receiver, OperatorConventions.EQUALS, KotlinBuiltIns.getInstance().getNullableAnyType());
TemporaryBindingTrace traceInterpretingRightAsNullableAny = TemporaryBindingTrace.create(
context.trace, "trace to resolve 'equals(Any?)' interpreting as of type Any? an expression:" + right);
traceInterpretingRightAsNullableAny.record(EXPRESSION_TYPE, right, KotlinBuiltIns.getInstance().getNullableAnyType());
traceInterpretingRightAsNullableAny.record(PROCESSED, right);
OverloadResolutionResults<FunctionDescriptor> resolutionResults =
resolveFakeCall(receiver, context.replaceBindingTrace(traceInterpretingRightAsNullableAny),
Collections.singletonList(right), OperatorConventions.EQUALS);
dataFlowInfo = facade.getTypeInfo(right, contextWithDataFlow).getDataFlowInfo();
@@ -362,7 +362,17 @@ public class ExpressionTypingUtils {
@NotNull ReceiverValue receiver,
@NotNull Name name
) {
return makeAndResolveFakeCall(receiver, context, Collections.<JetExpression>emptyList(), name).getSecond();
return resolveFakeCall(receiver, context, Collections.<JetExpression>emptyList(), name);
}
@NotNull
public static OverloadResolutionResults<FunctionDescriptor> resolveFakeCall(
@NotNull ReceiverValue receiver,
@NotNull ExpressionTypingContext context,
@NotNull List<JetExpression> valueArguments,
@NotNull Name name
) {
return makeAndResolveFakeCall(receiver, context, valueArguments, name).getSecond();
}
@NotNull