Change rendering for definitely non-nullable types from T!! to T & Any
^KT-26245 In Progress
This commit is contained in:
committed by
teamcityserver
parent
9e6af52e1f
commit
dc79d8641b
@@ -13,7 +13,7 @@ fun ConeKotlinType.render(): String {
|
|||||||
val nullabilitySuffix = if (this !is ConeFlexibleType && this !is ConeClassErrorType) nullability.suffix else ""
|
val nullabilitySuffix = if (this !is ConeFlexibleType && this !is ConeClassErrorType) nullability.suffix else ""
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is ConeTypeVariableType -> "${renderAttributes()}TypeVariable(${this.lookupTag.name})"
|
is ConeTypeVariableType -> "${renderAttributes()}TypeVariable(${this.lookupTag.name})"
|
||||||
is ConeDefinitelyNotNullType -> "${original.render()}!!"
|
is ConeDefinitelyNotNullType -> "${original.render()} & Any"
|
||||||
is ConeClassErrorType -> "${renderAttributes()}ERROR CLASS: ${diagnostic.reason}"
|
is ConeClassErrorType -> "${renderAttributes()}ERROR CLASS: ${diagnostic.reason}"
|
||||||
is ConeCapturedType -> "${renderAttributes()}CapturedType(${constructor.projection.render()})"
|
is ConeCapturedType -> "${renderAttributes()}CapturedType(${constructor.projection.render()})"
|
||||||
is ConeClassLikeType -> {
|
is ConeClassLikeType -> {
|
||||||
|
|||||||
@@ -853,7 +853,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
|||||||
is ConeCapturedType -> inlineUnsupported(type)
|
is ConeCapturedType -> inlineUnsupported(type)
|
||||||
is ConeDefinitelyNotNullType -> resolved {
|
is ConeDefinitelyNotNullType -> resolved {
|
||||||
generate(type.original)
|
generate(type.original)
|
||||||
+"!!"
|
+" & Any"
|
||||||
}
|
}
|
||||||
is ConeIntersectionType -> resolved { generate(type) }
|
is ConeIntersectionType -> resolved { generate(type) }
|
||||||
is ConeIntegerLiteralType -> inlineUnsupported(type)
|
is ConeIntegerLiteralType -> inlineUnsupported(type)
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import org.jetbrains.kotlin.types.*
|
|||||||
import org.jetbrains.kotlin.types.ErrorUtils.UninferredParameterTypeConstructor
|
import org.jetbrains.kotlin.types.ErrorUtils.UninferredParameterTypeConstructor
|
||||||
import org.jetbrains.kotlin.types.TypeUtils.CANT_INFER_FUNCTION_PARAM_TYPE
|
import org.jetbrains.kotlin.types.TypeUtils.CANT_INFER_FUNCTION_PARAM_TYPE
|
||||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
internal class DescriptorRendererImpl(
|
internal class DescriptorRendererImpl(
|
||||||
val options: DescriptorRendererOptionsImpl
|
val options: DescriptorRendererOptionsImpl
|
||||||
@@ -263,7 +262,7 @@ internal class DescriptorRendererImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type.isDefinitelyNotNullType) {
|
if (type.isDefinitelyNotNullType) {
|
||||||
append("!!")
|
append(" & Any")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ class DefinitelyNotNullType private constructor(
|
|||||||
override fun makeNullableAsSpecified(newNullability: Boolean): SimpleType =
|
override fun makeNullableAsSpecified(newNullability: Boolean): SimpleType =
|
||||||
if (newNullability) delegate.makeNullableAsSpecified(newNullability) else this
|
if (newNullability) delegate.makeNullableAsSpecified(newNullability) else this
|
||||||
|
|
||||||
override fun toString(): String = "$delegate!!"
|
override fun toString(): String = "$delegate & Any"
|
||||||
|
|
||||||
@TypeRefinement
|
@TypeRefinement
|
||||||
override fun replaceDelegate(delegate: SimpleType) = DefinitelyNotNullType(delegate, useCorrectedNullabilityForTypeParameters)
|
override fun replaceDelegate(delegate: SimpleType) = DefinitelyNotNullType(delegate, useCorrectedNullabilityForTypeParameters)
|
||||||
|
|||||||
Reference in New Issue
Block a user