TYPE_INFERENCE_ERROR resolution status added
if type inference failed, we don't want to return type with unsubstituted type parameters (like List<T>), so in this case we return error type
This commit is contained in:
@@ -26,12 +26,14 @@ public enum ResolutionStatus {
|
||||
UNSAFE_CALL_ERROR,
|
||||
OTHER_ERROR,
|
||||
STRONG_ERROR,
|
||||
TYPE_INFERENCE_ERROR,
|
||||
SUCCESS(true);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final EnumSet<ResolutionStatus>[] SEVERITY_LEVELS = new EnumSet[] {
|
||||
EnumSet.of(UNSAFE_CALL_ERROR), // weakest
|
||||
EnumSet.of(OTHER_ERROR),
|
||||
EnumSet.of(TYPE_INFERENCE_ERROR),
|
||||
EnumSet.of(STRONG_ERROR), // most severe
|
||||
};
|
||||
|
||||
|
||||
+11
-4
@@ -28,9 +28,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.diagnostics.Errors;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.CallMaker;
|
||||
import org.jetbrains.jet.lang.resolve.calls.OverloadResolutionResults;
|
||||
import org.jetbrains.jet.lang.resolve.calls.OverloadResolutionResultsUtil;
|
||||
import org.jetbrains.jet.lang.resolve.calls.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowValue;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowValueFactory;
|
||||
@@ -613,6 +611,14 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
if (!results.isNothing()) {
|
||||
checkSuper(receiver, results, context.trace, callExpression);
|
||||
result[0] = true;
|
||||
if (results.isSingleResult()) {
|
||||
ResolvedCall<FunctionDescriptor> resultingCall = results.getResultingCall();
|
||||
if (resultingCall instanceof ResolvedCallWithTrace) {
|
||||
if (((ResolvedCallWithTrace)resultingCall).getStatus() == ResolutionStatus.TYPE_INFERENCE_ERROR) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return results.isSingleResult() ? results.getResultingDescriptor() : null;
|
||||
}
|
||||
result[0] = false;
|
||||
@@ -733,7 +739,8 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
for (JetValueArgument argument : argumentList.getArguments()) {
|
||||
JetExpression expression = argument.getArgumentExpression();
|
||||
if (expression != null) {
|
||||
dataFlowInfo = dataFlowInfo.and(facade.getTypeInfo(expression, context.replaceDataFlowInfo(dataFlowInfo)).getDataFlowInfo());
|
||||
dataFlowInfo = dataFlowInfo.and(facade.getTypeInfo(expression, context.replaceExpectedType(NO_EXPECTED_TYPE).
|
||||
replaceDataFlowInfo(dataFlowInfo)).getDataFlowInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user