K1: report ABSTRACT_SUPER_CALL(_WARNING) also for 2+ steps to intersection
#KT-53953 Fixed
This commit is contained in:
+23
-9
@@ -804,15 +804,7 @@ internal object CheckSuperExpressionCallPart : ResolutionPart() {
|
||||
|
||||
if (callComponents.statelessCallbacks.isSuperExpression(resolvedCall.dispatchReceiverArgument)) {
|
||||
if (candidateDescriptor is CallableMemberDescriptor) {
|
||||
if (candidateDescriptor.modality == Modality.ABSTRACT) {
|
||||
addDiagnostic(AbstractSuperCall(resolvedCall.dispatchReceiverArgument!!))
|
||||
} else if (candidateDescriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE &&
|
||||
candidateDescriptor.overriddenDescriptors.size > 1
|
||||
) {
|
||||
if (candidateDescriptor.overriddenDescriptors.firstOrNull { !it.isInsideInterface }?.modality == Modality.ABSTRACT) {
|
||||
addDiagnostic(AbstractFakeOverrideSuperCall)
|
||||
}
|
||||
}
|
||||
checkSuperCandidateDescriptor(candidateDescriptor)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,6 +813,28 @@ internal object CheckSuperExpressionCallPart : ResolutionPart() {
|
||||
addDiagnostic(SuperAsExtensionReceiver(extensionReceiver))
|
||||
}
|
||||
}
|
||||
|
||||
private fun ResolutionCandidate.checkSuperCandidateDescriptor(candidateDescriptor: CallableMemberDescriptor) {
|
||||
if (candidateDescriptor.modality == Modality.ABSTRACT) {
|
||||
addDiagnostic(AbstractSuperCall(resolvedCall.dispatchReceiverArgument!!))
|
||||
} else if (candidateDescriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
|
||||
var intersectionFakeOverrideDescriptor = candidateDescriptor
|
||||
while (intersectionFakeOverrideDescriptor.overriddenDescriptors.size == 1) {
|
||||
intersectionFakeOverrideDescriptor = intersectionFakeOverrideDescriptor.overriddenDescriptors.first()
|
||||
if (intersectionFakeOverrideDescriptor.kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (intersectionFakeOverrideDescriptor.overriddenDescriptors.size > 1) {
|
||||
if (intersectionFakeOverrideDescriptor.overriddenDescriptors.firstOrNull {
|
||||
!it.isInsideInterface
|
||||
}?.modality == Modality.ABSTRACT
|
||||
) {
|
||||
addDiagnostic(AbstractFakeOverrideSuperCall)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal object ErrorDescriptorResolutionPart : ResolutionPart() {
|
||||
|
||||
Reference in New Issue
Block a user