diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-05-21 14:51:55 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-05-28 12:11:47 +0200 |
commit | 5f9299b074355e3f636da6eb6e1f9283f06ab8c7 (patch) | |
tree | 3ceb70a5dc2640f10e198535b1390c6aca14d223 /plugins/base/src/main | |
parent | dd5d4ba7d80b0880489cf74bb11549ff836fc41f (diff) | |
download | dokka-5f9299b074355e3f636da6eb6e1f9283f06ab8c7.tar.gz dokka-5f9299b074355e3f636da6eb6e1f9283f06ab8c7.tar.bz2 dokka-5f9299b074355e3f636da6eb6e1f9283f06ab8c7.zip |
Return types links in inner classes with generic parents
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index 65b83200..60182ba9 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -101,8 +101,7 @@ private class DokkaDescriptorVisitor( descriptor: PackageFragmentDescriptor, parent: DRIWithPlatformInfo ): DPackage { - val name = descriptor.fqName.asString().takeUnless { it.isBlank() } ?: - "[${sourceSet.sourceSetName} root]"// TODO: error-prone, find a better way to do it + val name = descriptor.fqName.asString().takeUnless { it.isBlank() } ?: fallbackPackageName() val driWithPlatform = DRI(packageName = name).withEmptyInfo() val scope = descriptor.getMemberScope() @@ -544,7 +543,7 @@ private class DokkaDescriptorVisitor( is DynamicType -> Dynamic else -> when (val ctor = constructor.declarationDescriptor) { is TypeParameterDescriptor -> OtherParameter( - declarationDRI = DRI.from(ctor.containingDeclaration), + declarationDRI = DRI.from(ctor.containingDeclaration).withPackageFallbackTo(fallbackPackageName()), name = ctor.name.asString() ) else -> TypeConstructor( @@ -694,4 +693,14 @@ private class DokkaDescriptorVisitor( private fun ConstantsEnumValue.fullEnumEntryName() = "${this.enumClassId.relativeClassName.asString()}.${this.enumEntryName.identifier}" + + private fun fallbackPackageName(): String = "[${sourceSet.sourceSetName} root]"// TODO: error-prone, find a better way to do it +} + +private fun DRI.withPackageFallbackTo(fallbackPackage: String): DRI { + return if(packageName.isNullOrBlank()){ + copy(packageName = fallbackPackage) + } else { + this + } } |