KT-14641: Nested type alias reference via an instance is an error.
This commit is contained in:
@@ -144,19 +144,25 @@ abstract class DescriptorRenderer {
|
||||
modifiers = DescriptorRendererModifier.ALL
|
||||
}
|
||||
|
||||
fun getClassKindPrefix(klass: ClassDescriptor): String {
|
||||
if (klass.isCompanionObject) {
|
||||
return "companion object"
|
||||
}
|
||||
return when (klass.kind) {
|
||||
ClassKind.CLASS -> "class"
|
||||
ClassKind.INTERFACE -> "interface"
|
||||
ClassKind.ENUM_CLASS -> "enum class"
|
||||
ClassKind.OBJECT -> "object"
|
||||
ClassKind.ANNOTATION_CLASS -> "annotation class"
|
||||
ClassKind.ENUM_ENTRY -> "enum entry"
|
||||
}
|
||||
}
|
||||
fun getClassifierKindPrefix(classifier: ClassifierDescriptorWithTypeParameters): String =
|
||||
when (classifier) {
|
||||
is TypeAliasDescriptor ->
|
||||
"typealias"
|
||||
is ClassDescriptor ->
|
||||
if (classifier.isCompanionObject) {
|
||||
"companion object"
|
||||
}
|
||||
else when (classifier.kind) {
|
||||
ClassKind.CLASS -> "class"
|
||||
ClassKind.INTERFACE -> "interface"
|
||||
ClassKind.ENUM_CLASS -> "enum class"
|
||||
ClassKind.OBJECT -> "object"
|
||||
ClassKind.ANNOTATION_CLASS -> "annotation class"
|
||||
ClassKind.ENUM_ENTRY -> "enum entry"
|
||||
}
|
||||
else ->
|
||||
throw AssertionError("Unexpected classifier: $classifier")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -931,7 +931,7 @@ internal class DescriptorRendererImpl(
|
||||
}
|
||||
|
||||
private fun renderClassKindPrefix(klass: ClassDescriptor, builder: StringBuilder) {
|
||||
builder.append(renderKeyword(DescriptorRenderer.getClassKindPrefix(klass)))
|
||||
builder.append(renderKeyword(DescriptorRenderer.getClassifierKindPrefix(klass)))
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user