Don't render pure error types in OverrideMemberChooserObject

#KT-34379 Fixed
This commit is contained in:
Vladimir Dolzhenko
2019-10-16 12:16:12 +02:00
parent 148a6bd54d
commit 30229da95a
8 changed files with 43 additions and 19 deletions
@@ -251,6 +251,7 @@ interface DescriptorRendererOptions {
var parameterNamesInFunctionalTypes: Boolean
var renderFunctionContracts: Boolean
var presentableUnresolvedTypes: Boolean
var informativeErrorType: Boolean
}
object ExcludedTypeAnnotations {
@@ -244,7 +244,11 @@ internal class DescriptorRendererImpl(
if (type is UnresolvedType && presentableUnresolvedTypes) {
append(type.presentableName)
} else {
append(type.constructor.toString()) // Debug name of an error type is more informative
if (type is ErrorType && !informativeErrorType) {
append(type.presentableName)
} else {
append(type.constructor.toString()) // Debug name of an error type is more informative
}
}
append(renderTypeArguments(type.arguments))
} else {
@@ -127,4 +127,6 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions {
override var presentableUnresolvedTypes: Boolean by property(false)
override var boldOnlyForNamesInHtml: Boolean by property(false)
override var informativeErrorType: Boolean by property(true)
}
@@ -22,10 +22,11 @@ import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner
import org.jetbrains.kotlin.types.refinement.TypeRefinement
open class ErrorType @JvmOverloads internal constructor(
override val constructor: TypeConstructor,
override val memberScope: MemberScope,
override val arguments: List<TypeProjection> = emptyList(),
override val isMarkedNullable: Boolean = false
override val constructor: TypeConstructor,
override val memberScope: MemberScope,
override val arguments: List<TypeProjection> = emptyList(),
override val isMarkedNullable: Boolean = false,
open val presentableName: String = "???"
) : SimpleType() {
override val annotations: Annotations
get() = Annotations.EMPTY
@@ -43,14 +44,14 @@ open class ErrorType @JvmOverloads internal constructor(
}
class UnresolvedType(
val presentableName: String,
constructor: TypeConstructor,
memberScope: MemberScope,
arguments: List<TypeProjection>,
isMarkedNullable: Boolean
override val presentableName: String,
constructor: TypeConstructor,
memberScope: MemberScope,
arguments: List<TypeProjection>,
isMarkedNullable: Boolean
) : ErrorType(constructor, memberScope, arguments, isMarkedNullable) {
override fun makeNullableAsSpecified(newNullability: Boolean): SimpleType =
UnresolvedType(presentableName, constructor, memberScope, arguments, newNullability)
UnresolvedType(presentableName, constructor, memberScope, arguments, newNullability)
@TypeRefinement
override fun refine(kotlinTypeRefiner: KotlinTypeRefiner) = this