Mark value arguments in case of empty delegation call
It's useful for quickfixes for these diagnostics
This commit is contained in:
@@ -168,7 +168,8 @@ public interface Errors {
|
||||
DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<PsiElement> PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> EXPLICIT_DELEGATION_CALL_REQUIRED = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<JetConstructorDelegationCall> EXPLICIT_DELEGATION_CALL_REQUIRED =
|
||||
DiagnosticFactory0.create(ERROR, PositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL);
|
||||
|
||||
// Trait-specific
|
||||
|
||||
|
||||
@@ -420,7 +420,8 @@ public object PositioningStrategies {
|
||||
override fun mark(element: JetConstructorDelegationCall): List<TextRange> {
|
||||
if (element.isEmpty()) {
|
||||
val constructor = element.getStrictParentOfType<JetSecondaryConstructor>()!!
|
||||
return markElement(constructor.getConstructorKeyword())
|
||||
val valueParameterList = constructor.getValueParameterList() ?: return markElement(constructor)
|
||||
return markRange(constructor.getConstructorKeyword(), valueParameterList.getLastChild())
|
||||
}
|
||||
return markElement(element.getCalleeExpression() ?: element)
|
||||
}
|
||||
|
||||
+1
-2
@@ -82,8 +82,7 @@ public class TracingStrategyForEmptyConstructorDelegationCall(
|
||||
}
|
||||
|
||||
private fun reportError(trace: BindingTrace) {
|
||||
val declaration = delegationCall.getParent() as JetSecondaryConstructor
|
||||
trace.report(Errors.EXPLICIT_DELEGATION_CALL_REQUIRED.on(declaration.getConstructorKeyword()))
|
||||
trace.report(Errors.EXPLICIT_DELEGATION_CALL_REQUIRED.on(delegationCall))
|
||||
}
|
||||
|
||||
// Underlying methods should not be called because such errors are impossible
|
||||
|
||||
Reference in New Issue
Block a user