[FIR] KT-54410: Report API_NOT_AVAILABLE for classifiers

Callable symbols with SinceKotlin are filtered out by a
resolution stage, but in K1 classifiers and property accessors
report API_NOT_AVAILABLE. K2 filters out properties with
unavailable accessors, but does nothing for classifiers.
This change fixes it.

^KT-54410 Fixed
This commit is contained in:
Nikolay Lunyak
2023-01-18 19:13:42 +02:00
committed by Space Team
parent fd52cc4224
commit 9be819087a
22 changed files with 144 additions and 12 deletions
@@ -619,6 +619,11 @@ object LightTreePositioningStrategies {
}
return super.mark(node, startOffset, endOffset, tree)
}
if (node.tokenType == KtNodeTypes.IMPORT_DIRECTIVE) {
tree.collectDescendantsOfType(node, KtNodeTypes.REFERENCE_EXPRESSION).lastOrNull()?.let {
return mark(it, it.startOffset, it.endOffset, tree)
}
}
if (node.tokenType == KtNodeTypes.TYPE_REFERENCE) {
val typeElement = tree.findChildByType(node, KtTokenSets.TYPE_ELEMENT_TYPES)
if (typeElement != null) {
@@ -851,6 +851,10 @@ object PositioningStrategies {
is KtElement -> return mark(selectorExpression)
}
}
if (element is KtImportDirective) {
element.alias?.nameIdentifier?.let { return mark(it) }
element.importedReference?.let { return mark(it) }
}
if (element is KtTypeReference) {
element.typeElement?.getReferencedTypeExpression()?.let { return mark(it) }
}