[AA] Fix KDoc reference resolution for non-static callables from supertypes
- We should use member scopes to find symbols from supertypes. - The issue was already fixed for static callables because the declared member scope was composed with the static member scope. See KTIJ-25960. ^KTIJ-26003 fixed
This commit is contained in:
committed by
Space Team
parent
2694326ef8
commit
2acee69908
+3
-15
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeContext
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtScopeKind
|
||||
import org.jetbrains.kotlin.analysis.api.scopes.KtScope
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtClassOrObjectSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.*
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithMembers
|
||||
@@ -20,7 +21,6 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||
import kotlin.reflect.KClass
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtClassOrObjectSymbol
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.parentOfType
|
||||
|
||||
internal object KDocReferenceResolver {
|
||||
@@ -192,12 +192,7 @@ internal object KDocReferenceResolver {
|
||||
currentScope
|
||||
.getClassifierSymbols(fqNamePart)
|
||||
.filterIsInstance<KtSymbolWithMembers>()
|
||||
.flatMap {
|
||||
listOf(
|
||||
it.getDeclaredMemberScope(),
|
||||
it.getStaticMemberScope(),
|
||||
)
|
||||
}
|
||||
.map { it.getCombinedMemberScope() }
|
||||
.toList()
|
||||
.asCompositeScope()
|
||||
}
|
||||
@@ -258,20 +253,13 @@ internal object KDocReferenceResolver {
|
||||
|
||||
else -> {
|
||||
getClassOrObjectSymbolByClassId(classId)
|
||||
?.let {
|
||||
listOf(
|
||||
it.getDeclaredMemberScope(),
|
||||
it.getStaticMemberScope(),
|
||||
)
|
||||
}
|
||||
?.asCompositeScope()
|
||||
?.getCombinedMemberScope()
|
||||
?.getCallableSymbols(callableId.callableName)
|
||||
?.let(::addAll)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun generateNameInterpretations(fqName: FqName): Sequence<FqNameInterpretation> = sequence {
|
||||
val parts = fqName.pathSegments()
|
||||
if (parts.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user