Minor, always report diagnostics on callee expression
As these kinds of diagnostic always have non-empty callee expression
This commit is contained in:
@@ -155,8 +155,7 @@ public interface Errors {
|
|||||||
|
|
||||||
// Secondary constructors
|
// Secondary constructors
|
||||||
|
|
||||||
DiagnosticFactory0<JetConstructorDelegationCall> CYCLIC_CONSTRUCTOR_DELEGATION_CALL =
|
DiagnosticFactory0<JetConstructorDelegationReferenceExpression> CYCLIC_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
|
|
||||||
|
|
||||||
DiagnosticFactory0<JetSecondaryConstructor> SECONDARY_CONSTRUCTOR_IN_OBJECT = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<JetSecondaryConstructor> SECONDARY_CONSTRUCTOR_IN_OBJECT = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<JetDelegatorToSuperCall> SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<JetDelegatorToSuperCall> SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR = DiagnosticFactory0.create(ERROR);
|
||||||
@@ -165,8 +164,8 @@ public interface Errors {
|
|||||||
DiagnosticFactory0<JetConstructorDelegationCall> PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED =
|
DiagnosticFactory0<JetConstructorDelegationCall> PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED =
|
||||||
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
|
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
|
||||||
|
|
||||||
DiagnosticFactory0<JetConstructorDelegationCall> DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR =
|
DiagnosticFactory0<JetConstructorDelegationReferenceExpression> DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR =
|
||||||
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
|
DiagnosticFactory0.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory0<PsiElement> PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<PsiElement> PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS = DiagnosticFactory0.create(ERROR);
|
||||||
DiagnosticFactory0<PsiElement> EXPLICIT_DELEGATION_CALL_REQUIRED = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<PsiElement> EXPLICIT_DELEGATION_CALL_REQUIRED = DiagnosticFactory0.create(ERROR);
|
||||||
|
|||||||
@@ -217,8 +217,8 @@ public class BodyResolver {
|
|||||||
PsiElement constructorToReport = DescriptorToSourceUtils.descriptorToDeclaration(currentConstructor);
|
PsiElement constructorToReport = DescriptorToSourceUtils.descriptorToDeclaration(currentConstructor);
|
||||||
if (constructorToReport != null) {
|
if (constructorToReport != null) {
|
||||||
JetConstructorDelegationCall call = ((JetSecondaryConstructor) constructorToReport).getDelegationCall();
|
JetConstructorDelegationCall call = ((JetSecondaryConstructor) constructorToReport).getDelegationCall();
|
||||||
assert call != null : "resolved call can't be null";
|
assert call != null && call.getCalleeExpression() != null : "resolved call and it's callee can't be null";
|
||||||
trace.report(CYCLIC_CONSTRUCTOR_DELEGATION_CALL.on(call));
|
trace.report(CYCLIC_CONSTRUCTOR_DELEGATION_CALL.on(call.getCalleeExpression()));
|
||||||
}
|
}
|
||||||
|
|
||||||
currentConstructor = getDelegatedConstructor(currentConstructor);
|
currentConstructor = getDelegatedConstructor(currentConstructor);
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ public class CallResolver {
|
|||||||
|
|
||||||
boolean isThisCall = calleeExpression.isThis();
|
boolean isThisCall = calleeExpression.isThis();
|
||||||
if (currentClassDescriptor.getKind() == ClassKind.ENUM_CLASS && !isThisCall) {
|
if (currentClassDescriptor.getKind() == ClassKind.ENUM_CLASS && !isThisCall) {
|
||||||
context.trace.report(DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR.on((JetConstructorDelegationCall) calleeExpression.getParent()));
|
context.trace.report(DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR.on(calleeExpression));
|
||||||
return checkArgumentTypesAndFail(context);
|
return checkArgumentTypesAndFail(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user