EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT is now reported on property if accessor is external #KT-9297 Fixed

Also fixes EA-89227
This commit is contained in:
Mikhail Glukhikh
2016-10-25 16:48:38 +03:00
parent e053b77ede
commit 2130164d9b
4 changed files with 38 additions and 1 deletions
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtDeclarationWithBody
import org.jetbrains.kotlin.psi.KtPropertyAccessor
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.checkers.SimpleDeclarationChecker
@@ -40,7 +41,12 @@ class ExternalFunChecker : SimpleDeclarationChecker {
}
else if (descriptor is CallableMemberDescriptor &&
descriptor.modality == Modality.ABSTRACT) {
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration))
if (declaration is KtPropertyAccessor) {
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration.property))
}
else {
diagnosticHolder.report(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT.on(declaration))
}
}
if (descriptor !is ConstructorDescriptor && declaration is KtDeclarationWithBody && declaration.hasBody()) {