Got rid of getText() when reporting unresolved reference.
This commit is contained in:
@@ -68,7 +68,8 @@ public interface Errors {
|
|||||||
|
|
||||||
DiagnosticFactory1<PsiElement, String> REDECLARATION = DiagnosticFactory1.create(ERROR, FOR_REDECLARATION);
|
DiagnosticFactory1<PsiElement, String> REDECLARATION = DiagnosticFactory1.create(ERROR, FOR_REDECLARATION);
|
||||||
|
|
||||||
DiagnosticFactory1<JetReferenceExpression, String> UNRESOLVED_REFERENCE = DiagnosticFactory1.create(ERROR, FOR_UNRESOLVED_REFERENCE);
|
DiagnosticFactory1<JetReferenceExpression, JetReferenceExpression> UNRESOLVED_REFERENCE =
|
||||||
|
DiagnosticFactory1.create(ERROR, FOR_UNRESOLVED_REFERENCE);
|
||||||
|
|
||||||
//Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error
|
//Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error
|
||||||
//"INVISIBLE_REFERENCE" is used for invisible classes references and references in import
|
//"INVISIBLE_REFERENCE" is used for invisible classes references and references in import
|
||||||
@@ -308,7 +309,7 @@ public interface Errors {
|
|||||||
|
|
||||||
DiagnosticFactory0<PsiElement> MIXING_NAMED_AND_POSITIONED_ARGUMENTS = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<PsiElement> MIXING_NAMED_AND_POSITIONED_ARGUMENTS = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<JetReferenceExpression> ARGUMENT_PASSED_TWICE = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<JetReferenceExpression> ARGUMENT_PASSED_TWICE = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory1<JetReferenceExpression, String> NAMED_PARAMETER_NOT_FOUND =
|
DiagnosticFactory1<JetReferenceExpression, JetReferenceExpression> NAMED_PARAMETER_NOT_FOUND =
|
||||||
DiagnosticFactory1.create(ERROR, FOR_UNRESOLVED_REFERENCE);
|
DiagnosticFactory1.create(ERROR, FOR_UNRESOLVED_REFERENCE);
|
||||||
|
|
||||||
DiagnosticFactory0<JetExpression> VARARG_OUTSIDE_PARENTHESES = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<JetExpression> VARARG_OUTSIDE_PARENTHESES = DiagnosticFactory0.create(ERROR);
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@ public class DefaultErrorMessages {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
MAP.put(UNRESOLVED_REFERENCE, "Unresolved reference: {0}", TO_STRING);
|
MAP.put(UNRESOLVED_REFERENCE, "Unresolved reference: {0}", ELEMENT_TEXT);
|
||||||
|
|
||||||
MAP.put(INVISIBLE_REFERENCE, "Cannot access ''{0}'': it is ''{1}'' in ''{2}''", NAME, TO_STRING, NAME);
|
MAP.put(INVISIBLE_REFERENCE, "Cannot access ''{0}'': it is ''{1}'' in ''{2}''", NAME, TO_STRING, NAME);
|
||||||
MAP.put(INVISIBLE_MEMBER, "Cannot access ''{0}'': it is ''{1}'' in ''{2}''", NAME, TO_STRING, NAME);
|
MAP.put(INVISIBLE_MEMBER, "Cannot access ''{0}'': it is ''{1}'' in ''{2}''", NAME, TO_STRING, NAME);
|
||||||
@@ -109,7 +109,7 @@ public class DefaultErrorMessages {
|
|||||||
|
|
||||||
MAP.put(MIXING_NAMED_AND_POSITIONED_ARGUMENTS, "Mixing named and positioned arguments in not allowed");
|
MAP.put(MIXING_NAMED_AND_POSITIONED_ARGUMENTS, "Mixing named and positioned arguments in not allowed");
|
||||||
MAP.put(ARGUMENT_PASSED_TWICE, "An argument is already passed for this parameter");
|
MAP.put(ARGUMENT_PASSED_TWICE, "An argument is already passed for this parameter");
|
||||||
MAP.put(NAMED_PARAMETER_NOT_FOUND, "Cannot find a parameter with this name: {0}", TO_STRING);
|
MAP.put(NAMED_PARAMETER_NOT_FOUND, "Cannot find a parameter with this name: {0}", ELEMENT_TEXT);
|
||||||
MAP.put(VARARG_OUTSIDE_PARENTHESES, "Passing value as a vararg is only allowed inside a parenthesized argument list");
|
MAP.put(VARARG_OUTSIDE_PARENTHESES, "Passing value as a vararg is only allowed inside a parenthesized argument list");
|
||||||
MAP.put(NON_VARARG_SPREAD, "The spread operator (*foo) may only be applied in a vararg position");
|
MAP.put(NON_VARARG_SPREAD, "The spread operator (*foo) may only be applied in a vararg position");
|
||||||
|
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ public class DescriptorResolver {
|
|||||||
trace.record(BindingContext.REFERENCE_TARGET, subjectTypeParameterName, classifier);
|
trace.record(BindingContext.REFERENCE_TARGET, subjectTypeParameterName, classifier);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
trace.report(UNRESOLVED_REFERENCE.on(subjectTypeParameterName, subjectTypeParameterName.getText()));
|
trace.report(UNRESOLVED_REFERENCE.on(subjectTypeParameterName, subjectTypeParameterName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+1
-1
@@ -359,7 +359,7 @@ public class QualifiedExpressionResolver {
|
|||||||
// Simple case of no descriptors
|
// Simple case of no descriptors
|
||||||
if (descriptors.isEmpty()) {
|
if (descriptors.isEmpty()) {
|
||||||
trace.record(BindingContext.RESOLUTION_SCOPE, referenceExpression, resolutionScope);
|
trace.record(BindingContext.RESOLUTION_SCOPE, referenceExpression, resolutionScope);
|
||||||
trace.report(UNRESOLVED_REFERENCE.on(referenceExpression, referenceExpression.getText()));
|
trace.report(UNRESOLVED_REFERENCE.on(referenceExpression, referenceExpression));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ public class CallResolver {
|
|||||||
resolveFunctionArguments(context, resultsForFirstNonemptyCandidateSet);
|
resolveFunctionArguments(context, resultsForFirstNonemptyCandidateSet);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
context.trace.report(UNRESOLVED_REFERENCE.on(reference, reference.getText()));
|
context.trace.report(UNRESOLVED_REFERENCE.on(reference, reference));
|
||||||
argumentTypeResolver.checkTypesWithNoCallee(context, RESOLVE_FUNCTION_ARGUMENTS);
|
argumentTypeResolver.checkTypesWithNoCallee(context, RESOLVE_FUNCTION_ARGUMENTS);
|
||||||
}
|
}
|
||||||
return resultsForFirstNonemptyCandidateSet != null ? resultsForFirstNonemptyCandidateSet : OverloadResolutionResultsImpl.<F>nameNotFound();
|
return resultsForFirstNonemptyCandidateSet != null ? resultsForFirstNonemptyCandidateSet : OverloadResolutionResultsImpl.<F>nameNotFound();
|
||||||
|
|||||||
+1
-1
@@ -153,7 +153,7 @@ import static org.jetbrains.jet.lang.resolve.calls.ValueArgumentsToParametersMap
|
|||||||
JetSimpleNameExpression nameReference = argument.getArgumentName().getReferenceExpression();
|
JetSimpleNameExpression nameReference = argument.getArgumentName().getReferenceExpression();
|
||||||
ValueParameterDescriptor valueParameterDescriptor = parameterByName.get(nameReference.getReferencedNameAsName());
|
ValueParameterDescriptor valueParameterDescriptor = parameterByName.get(nameReference.getReferencedNameAsName());
|
||||||
if (valueParameterDescriptor == null) {
|
if (valueParameterDescriptor == null) {
|
||||||
report(NAMED_PARAMETER_NOT_FOUND.on(nameReference, nameReference.getText()));
|
report(NAMED_PARAMETER_NOT_FOUND.on(nameReference, nameReference));
|
||||||
unmappedArguments.add(argument);
|
unmappedArguments.add(argument);
|
||||||
setStatus(WEAK_ERROR);
|
setStatus(WEAK_ERROR);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ public class TracingStrategyImpl implements TracingStrategy {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unresolvedReference(@NotNull BindingTrace trace) {
|
public void unresolvedReference(@NotNull BindingTrace trace) {
|
||||||
trace.report(UNRESOLVED_REFERENCE.on(reference, reference.getText()));
|
trace.report(UNRESOLVED_REFERENCE.on(reference, reference));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -217,7 +217,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
|||||||
|
|
||||||
if (leftType == null) {
|
if (leftType == null) {
|
||||||
dataFlowInfo = facade.getTypeInfo(right, context.replaceDataFlowInfo(dataFlowInfo)).getDataFlowInfo();
|
dataFlowInfo = facade.getTypeInfo(right, context.replaceDataFlowInfo(dataFlowInfo)).getDataFlowInfo();
|
||||||
context.trace.report(UNRESOLVED_REFERENCE.on(operationSign, operationSign.getText()));
|
context.trace.report(UNRESOLVED_REFERENCE.on(operationSign, operationSign));
|
||||||
temporaryBindingTrace.commit();
|
temporaryBindingTrace.commit();
|
||||||
return JetTypeInfo.create(null, dataFlowInfo);
|
return JetTypeInfo.create(null, dataFlowInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class LabelResolver {
|
|||||||
Stack<JetElement> stack = labeledElements.get(labelName);
|
Stack<JetElement> stack = labeledElements.get(labelName);
|
||||||
if (stack == null || stack.isEmpty()) {
|
if (stack == null || stack.isEmpty()) {
|
||||||
if (reportUnresolved) {
|
if (reportUnresolved) {
|
||||||
context.trace.report(UNRESOLVED_REFERENCE.on(labelExpression, labelExpression.getText()));
|
context.trace.report(UNRESOLVED_REFERENCE.on(labelExpression, labelExpression));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -174,11 +174,11 @@ public class LabelResolver {
|
|||||||
return LabeledReceiverResolutionResult.labelResolutionSuccess(thisReceiver);
|
return LabeledReceiverResolutionResult.labelResolutionSuccess(thisReceiver);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
context.trace.report(UNRESOLVED_REFERENCE.on(targetLabel, targetLabel.getText()));
|
context.trace.report(UNRESOLVED_REFERENCE.on(targetLabel, targetLabel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
context.trace.report(UNRESOLVED_REFERENCE.on(targetLabel, targetLabel.getText()));
|
context.trace.report(UNRESOLVED_REFERENCE.on(targetLabel, targetLabel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user