Fix rendering of local anonymous object types for quick doc

#KT-8893 fixed
This commit is contained in:
Simon Ogorodnik
2017-06-27 21:42:42 +03:00
parent 25109671b1
commit ab919886ae
3 changed files with 34 additions and 0 deletions
@@ -60,6 +60,25 @@ import org.jetbrains.kotlin.utils.addToStdlib.constant
class HtmlClassifierNamePolicy(val base: ClassifierNamePolicy) : ClassifierNamePolicy {
override fun renderClassifier(classifier: ClassifierDescriptor, renderer: DescriptorRenderer): String {
if (DescriptorUtils.isAnonymousObject(classifier)) {
val supertypes = classifier.typeConstructor.supertypes
return buildString {
append("<anonymous object")
if (supertypes.isNotEmpty()) {
append(" : ")
supertypes.joinTo(this) {
val ref = it.constructor.declarationDescriptor
if (ref != null)
renderClassifier(ref, renderer)
else
"<ERROR CLASS>"
}
}
append(">")
}
}
val name = base.renderClassifier(classifier, renderer)
if (classifier.isBoringBuiltinClass())
return name