[renderer] render presentable unresolved type with 'presentableUnresolvedTypes' option
^KT-49643 Fixed
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -242,15 +242,16 @@ internal class DescriptorRendererImpl(
|
|||||||
when {
|
when {
|
||||||
type.isError -> {
|
type.isError -> {
|
||||||
if (isUnresolvedType(type) && presentableUnresolvedTypes) {
|
if (isUnresolvedType(type) && presentableUnresolvedTypes) {
|
||||||
append(type.debugMessage)
|
append(renderError(ErrorUtils.unresolvedTypeAsItIs(type)))
|
||||||
} else {
|
} else {
|
||||||
if (type is ErrorType && !informativeErrorType) {
|
if (type is ErrorType && !informativeErrorType) {
|
||||||
append(type.debugMessage)
|
append(type.debugMessage)
|
||||||
} else {
|
} else {
|
||||||
append(type.constructor.toString()) // Debug name of an error type is more informative
|
append(type.constructor.toString()) // Debug name of an error type is more informative
|
||||||
}
|
}
|
||||||
|
|
||||||
|
append(renderTypeArguments(type.arguments))
|
||||||
}
|
}
|
||||||
append(renderTypeArguments(type.arguments))
|
|
||||||
}
|
}
|
||||||
type is StubTypeForBuilderInference ->
|
type is StubTypeForBuilderInference ->
|
||||||
append(type.originalTypeVariable.toString())
|
append(type.originalTypeVariable.toString())
|
||||||
|
|||||||
@@ -5,10 +5,18 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.types.error
|
package org.jetbrains.kotlin.types.error
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||||
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
|
import org.jetbrains.kotlin.types.TypeConstructor
|
||||||
|
import org.jetbrains.kotlin.types.TypeProjection
|
||||||
|
import org.jetbrains.kotlin.types.isError
|
||||||
import org.jetbrains.kotlin.types.typeUtil.contains
|
import org.jetbrains.kotlin.types.typeUtil.contains
|
||||||
|
import org.jetbrains.kotlin.types.typeUtil.isUnresolvedType
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
||||||
|
|
||||||
object ErrorUtils {
|
object ErrorUtils {
|
||||||
val errorModule: ModuleDescriptor = ErrorModuleDescriptor
|
val errorModule: ModuleDescriptor = ErrorModuleDescriptor
|
||||||
@@ -99,4 +107,9 @@ object ErrorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun containsUninferredTypeVariable(type: KotlinType): Boolean = type.contains(::isUninferredTypeVariable)
|
fun containsUninferredTypeVariable(type: KotlinType): Boolean = type.contains(::isUninferredTypeVariable)
|
||||||
|
|
||||||
|
fun unresolvedTypeAsItIs(type: KotlinType): String {
|
||||||
|
assert(isUnresolvedType(type))
|
||||||
|
return type.constructor.cast<ErrorTypeConstructor>().getParam(0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user