diff options
author | Andrzej Ratajczak <andrzej.ratajczak98@gmail.com> | 2020-09-08 17:03:31 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-09-10 13:11:02 +0200 |
commit | 37db297bfc00a12114122db06f34091528ed03e3 (patch) | |
tree | 17c4140d6286fbee1e312be952a5af6512a5d232 /plugins/base/src | |
parent | 79ab595fe44c3588ae07cd5130bb9d63d6085f07 (diff) | |
download | dokka-37db297bfc00a12114122db06f34091528ed03e3.tar.gz dokka-37db297bfc00a12114122db06f34091528ed03e3.tar.bz2 dokka-37db297bfc00a12114122db06f34091528ed03e3.zip |
Fix presentation of typealiases
Diffstat (limited to 'plugins/base/src')
3 files changed, 24 insertions, 19 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt index 14111a3b..43ffff85 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt @@ -68,7 +68,7 @@ open class DokkaLocationProvider( private fun getLocalLocation(dri: Pair<DRI, DisplaySourceSet?>, context: PageNode?): String? = pagesIndex[dri]?.let { resolve(it, context) } - ?: anchorsIndex[dri]?.let { resolve(it, context) + "#$dri" } + ?: anchorsIndex[dri]?.let { resolve(it, context) + "#${dri.first}" } override fun pathToRoot(from: PageNode): String = diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 5e6f8f20..d42acb32 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -631,20 +631,26 @@ private class DokkaDescriptorVisitor( private fun KotlinType.toBound(): Bound = when (this) { is DynamicType -> Dynamic - else -> when (val ctor = constructor.declarationDescriptor) { - is TypeParameterDescriptor -> TypeParameter( - dri = DRI.from(ctor), - name = ctor.name.asString() - ) - else -> TypeConstructor( - DRI.from(ctor!!), // TODO: remove '!!' - arguments.map { it.toProjection() }, - if (isExtensionFunctionType) FunctionModifiers.EXTENSION - else if (isFunctionType) FunctionModifiers.FUNCTION - else FunctionModifiers.NONE - ) - }.let { - if (isMarkedNullable) Nullable(it) else it + else -> { + val ctor = when (this) { + is AbbreviatedType -> abbreviation.constructor.declarationDescriptor + else -> constructor.declarationDescriptor + } + when (ctor) { + is TypeParameterDescriptor -> TypeParameter( + dri = DRI.from(ctor), + name = ctor.name.asString() + ) + else -> TypeConstructor( + DRI.from(ctor!!), // TODO: remove '!!' + arguments.map { it.toProjection() }, + if (isExtensionFunctionType) FunctionModifiers.EXTENSION + else if (isFunctionType) FunctionModifiers.FUNCTION + else FunctionModifiers.NONE + ) + }.let { + if (isMarkedNullable) Nullable(it) else it + } } } diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 55e59b77..a702766e 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs import kotlin.reflect.KClass import kotlin.reflect.full.isSubclassOf import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet +import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint import org.jetbrains.dokka.base.transformers.documentables.ClashingDriIdentifier private typealias GroupedTags = Map<KClass<out TagWrapper>, List<Pair<DokkaSourceSet?, TagWrapper>>> @@ -73,8 +74,6 @@ open class DefaultPageCreator( open fun pageForFunction(f: DFunction) = MemberPageNode(f.name, contentForFunction(f), setOf(f.dri), f) - open fun pageForTypeAlias(t: DTypeAlias) = MemberPageNode(t.name, contentForTypeAlias(t), setOf(t.dri), t) - private val WithScope.filteredFunctions: List<DFunction> get() = functions.mapNotNull { function -> function.takeIf { @@ -476,7 +475,7 @@ open class DefaultPageCreator( } protected open fun contentForFunction(f: DFunction) = contentForMember(f) - protected open fun contentForTypeAlias(t: DTypeAlias) = contentForMember(t) + protected open fun contentForMember(d: Documentable) = contentBuilder.contentFor(d) { group(kind = ContentKind.Cover) { cover(d.name.orEmpty()) @@ -522,7 +521,7 @@ open class DefaultPageCreator( kind = kind ) { elements.map { - instance(setOf(it.dri), it.sourceSets.toSet()) { + instance(setOf(it.dri), it.sourceSets.toSet(), extra = PropertyContainer.withAll(SymbolAnchorHint)) { before { contentForBrief(it) contentForSinceKotlin(it) |