Provide migration of Any functions via super in abstract case

Related to KT-38078
This commit is contained in:
Mikhail Glukhikh
2022-01-11 13:29:31 +03:00
parent 390fa682b9
commit fdf336042b
12 changed files with 68 additions and 29 deletions
@@ -812,9 +812,8 @@ internal object CheckSuperExpressionCallPart : ResolutionPart() {
if (callComponents.statelessCallbacks.isSuperExpression(resolvedCall.dispatchReceiverArgument)) {
if (candidateDescriptor is CallableMemberDescriptor) {
if (candidateDescriptor.modality == Modality.ABSTRACT) {
addDiagnostic(AbstractSuperCall)
}
if (candidateDescriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE &&
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) {
@@ -202,7 +202,7 @@ object InstantiationOfAbstractClass : KotlinCallDiagnostic(RUNTIME_ERROR) {
override fun report(reporter: DiagnosticReporter) = reporter.onCall(this)
}
object AbstractSuperCall : KotlinCallDiagnostic(RUNTIME_ERROR) {
class AbstractSuperCall(val receiver: SimpleKotlinCallArgument) : KotlinCallDiagnostic(RUNTIME_ERROR) {
override fun report(reporter: DiagnosticReporter) {
reporter.onCall(this)
}