aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Kotlin/DocumentationBuilder.kt15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 693f2675..1d7589a5 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -101,10 +101,10 @@ class DocumentationBuilder(val session: ResolveSession,
fun resolveContentLink(descriptor: DeclarationDescriptor, href: String): ContentBlock {
val symbols = resolveKDocLink(session, descriptor, null, href.split('.').toList())
+ val symbol = findTargetSymbol(symbols)
// don't include unresolved links in generated doc
// assume that if an href doesn't contain '/', it's not an attempt to reference an external file
- if (symbols.isNotEmpty()) {
- val symbol = symbols.first()
+ if (symbol != null) {
return ContentNodeLazyLink(href, {() -> refGraph.lookup(symbol.signature()) })
}
if ("/" in href) {
@@ -113,6 +113,17 @@ class DocumentationBuilder(val session: ResolveSession,
return ContentExternalLink("#")
}
+ fun findTargetSymbol(symbols: Collection<DeclarationDescriptor>): DeclarationDescriptor? {
+ if (symbols.isEmpty()) {
+ return null
+ }
+ val symbol = symbols.first()
+ if (symbol is CallableMemberDescriptor && symbol.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
+ return symbol.getOverriddenDescriptors().firstOrNull()
+ }
+ return symbol
+ }
+
fun KDocSection.getTags(): Array<KDocTag> = PsiTreeUtil.getChildrenOfType(this, javaClass<KDocTag>()) ?: array()
private fun Content.addTagToSeeAlso(descriptor: DeclarationDescriptor, seeTag: KDocTag) {