From 45bec5b68c2da35860877c6298bff04a4cb3d1d6 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Wed, 19 Aug 2020 12:57:38 +0200 Subject: Fix LinkProvider to link properly all nested generic parameters --- .../src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'kotlin-analysis/src/main/kotlin/org/jetbrains') diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt index 513817f3..217a3b7d 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/DRIFactory.kt @@ -1,9 +1,6 @@ package org.jetbrains.dokka.analysis -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiField -import com.intellij.psi.PsiMethod +import com.intellij.psi.* import org.jetbrains.dokka.links.Callable import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.links.DriTarget @@ -28,7 +25,7 @@ fun DRI.Companion.from(descriptor: DeclarationDescriptor) = descriptor.parentsWi fun DRI.Companion.from(psi: PsiElement) = psi.parentsWithSelf.run { val psiMethod = firstIsInstanceOrNull() val psiField = firstIsInstanceOrNull() - val classes = filterIsInstance().toList() + val classes = filterIsInstance().filterNot { it is PsiTypeParameter }.toList() // We only want exact PsiClass types, not PsiTypeParameter subtype DRI( classes.lastOrNull()?.qualifiedName?.substringBeforeLast('.', ""), classes.toList().takeIf { it.isNotEmpty() }?.asReversed()?.mapNotNull { it.name }?.joinToString("."), -- cgit