AA/FIR: differentiate dynamic type rendering
This commit is contained in:
committed by
Ilya Kirillov
parent
2d52c59bc7
commit
b6371a5b9a
+1
@@ -54,6 +54,7 @@ internal class KtFe10TypeRenderer(private val options: KtTypeRendererOptions, pr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (val unwrappedType = type.unwrap()) {
|
when (val unwrappedType = type.unwrap()) {
|
||||||
|
is DynamicType -> append("dynamic")
|
||||||
is FlexibleType -> renderFlexibleType(unwrappedType)
|
is FlexibleType -> renderFlexibleType(unwrappedType)
|
||||||
is DefinitelyNotNullType -> renderDefinitelyNotNullType(unwrappedType)
|
is DefinitelyNotNullType -> renderDefinitelyNotNullType(unwrappedType)
|
||||||
is ErrorType -> renderErrorType()
|
is ErrorType -> renderErrorType()
|
||||||
|
|||||||
+9
-3
@@ -48,7 +48,6 @@ internal class ConeTypeIdeRenderer(
|
|||||||
is ConeErrorType -> {
|
is ConeErrorType -> {
|
||||||
renderErrorType(type)
|
renderErrorType(type)
|
||||||
}
|
}
|
||||||
//is Dynamic??? -> append("dynamic")
|
|
||||||
is ConeClassLikeType -> {
|
is ConeClassLikeType -> {
|
||||||
if (options.renderFunctionType && shouldRenderAsPrettyFunctionType(type)) {
|
if (options.renderFunctionType && shouldRenderAsPrettyFunctionType(type)) {
|
||||||
renderAnnotationList(type)
|
renderAnnotationList(type)
|
||||||
@@ -70,9 +69,11 @@ internal class ConeTypeIdeRenderer(
|
|||||||
}
|
}
|
||||||
renderNullability(type.type)
|
renderNullability(type.type)
|
||||||
}
|
}
|
||||||
|
is ConeDynamicType -> {
|
||||||
|
append("dynamic")
|
||||||
|
}
|
||||||
is ConeFlexibleType -> {
|
is ConeFlexibleType -> {
|
||||||
renderAnnotationList(type)
|
renderFlexibleType(type)
|
||||||
append(renderFlexibleType(renderType(type.lowerBound), renderType(type.upperBound)))
|
|
||||||
}
|
}
|
||||||
is ConeCapturedType -> {
|
is ConeCapturedType -> {
|
||||||
renderAnnotationList(type)
|
renderAnnotationList(type)
|
||||||
@@ -88,6 +89,11 @@ internal class ConeTypeIdeRenderer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun StringBuilder.renderFlexibleType(type: ConeFlexibleType) {
|
||||||
|
renderAnnotationList(type)
|
||||||
|
append(renderFlexibleType(renderType(type.lowerBound), renderType(type.upperBound)))
|
||||||
|
}
|
||||||
|
|
||||||
private fun StringBuilder.renderErrorType(type: ConeErrorType) {
|
private fun StringBuilder.renderErrorType(type: ConeErrorType) {
|
||||||
val diagnostic = type.diagnostic
|
val diagnostic = type.diagnostic
|
||||||
if (options.renderUnresolvedTypeAsResolved && diagnostic is ConeUnresolvedError) {
|
if (options.renderUnresolvedTypeAsResolved && diagnostic is ConeUnresolvedError) {
|
||||||
|
|||||||
@@ -1,113 +0,0 @@
|
|||||||
KtKotlinPropertySymbol:
|
|
||||||
annotationsList: []
|
|
||||||
callableIdIfNonLocal: /Foo.p
|
|
||||||
getter: KtPropertyGetterSymbol(<getter>)
|
|
||||||
hasBackingField: true
|
|
||||||
hasGetter: true
|
|
||||||
hasSetter: false
|
|
||||||
initializer: KtConstantInitializerValue(null)
|
|
||||||
isConst: false
|
|
||||||
isDelegatedProperty: false
|
|
||||||
isExtension: false
|
|
||||||
isFromPrimaryConstructor: false
|
|
||||||
isLateInit: false
|
|
||||||
isOverride: false
|
|
||||||
isStatic: false
|
|
||||||
isVal: true
|
|
||||||
modality: FINAL
|
|
||||||
name: p
|
|
||||||
origin: SOURCE
|
|
||||||
receiverType: null
|
|
||||||
returnType: ft<kotlin/Nothing, kotlin/Any?>
|
|
||||||
setter: null
|
|
||||||
symbolKind: CLASS_MEMBER
|
|
||||||
typeParameters: []
|
|
||||||
visibility: Public
|
|
||||||
getDispatchReceiver(): Foo
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
getterDeprecationStatus: null
|
|
||||||
javaGetterName: getP
|
|
||||||
javaSetterName: null
|
|
||||||
setterDeprecationStatus: null
|
|
||||||
|
|
||||||
KtValueParameterSymbol:
|
|
||||||
annotationsList: []
|
|
||||||
callableIdIfNonLocal: null
|
|
||||||
generatedPrimaryConstructorProperty: null
|
|
||||||
hasDefaultValue: false
|
|
||||||
isExtension: false
|
|
||||||
isImplicitLambdaParameter: false
|
|
||||||
isVararg: false
|
|
||||||
name: p
|
|
||||||
origin: SOURCE
|
|
||||||
receiverType: null
|
|
||||||
returnType: ft<kotlin/Nothing, kotlin/Any?>
|
|
||||||
symbolKind: LOCAL
|
|
||||||
typeParameters: []
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
|
|
||||||
KtAnonymousFunctionSymbol:
|
|
||||||
annotationsList: []
|
|
||||||
callableIdIfNonLocal: null
|
|
||||||
hasStableParameterNames: true
|
|
||||||
isExtension: false
|
|
||||||
origin: SOURCE
|
|
||||||
receiverType: null
|
|
||||||
returnType: ft<kotlin/Nothing, kotlin/Any?>
|
|
||||||
symbolKind: LOCAL
|
|
||||||
typeParameters: []
|
|
||||||
valueParameters: []
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
|
|
||||||
KtFunctionSymbol:
|
|
||||||
annotationsList: []
|
|
||||||
callableIdIfNonLocal: /Foo.f
|
|
||||||
hasStableParameterNames: true
|
|
||||||
isBuiltinFunctionInvoke: false
|
|
||||||
isExtension: false
|
|
||||||
isExternal: false
|
|
||||||
isInfix: false
|
|
||||||
isInline: false
|
|
||||||
isOperator: false
|
|
||||||
isOverride: false
|
|
||||||
isStatic: false
|
|
||||||
isSuspend: false
|
|
||||||
modality: FINAL
|
|
||||||
name: f
|
|
||||||
origin: SOURCE
|
|
||||||
receiverType: null
|
|
||||||
returnType: ft<kotlin/Nothing, kotlin/Any?>
|
|
||||||
symbolKind: CLASS_MEMBER
|
|
||||||
typeParameters: []
|
|
||||||
valueParameters: [
|
|
||||||
KtValueParameterSymbol(p)
|
|
||||||
]
|
|
||||||
visibility: Public
|
|
||||||
getDispatchReceiver(): Foo
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
|
|
||||||
KtNamedClassOrObjectSymbol:
|
|
||||||
annotationsList: []
|
|
||||||
classIdIfNonLocal: Foo
|
|
||||||
classKind: CLASS
|
|
||||||
companionObject: null
|
|
||||||
isData: false
|
|
||||||
isExternal: false
|
|
||||||
isFun: false
|
|
||||||
isInline: false
|
|
||||||
isInner: false
|
|
||||||
modality: FINAL
|
|
||||||
name: Foo
|
|
||||||
origin: SOURCE
|
|
||||||
superTypes: [
|
|
||||||
kotlin/Any
|
|
||||||
]
|
|
||||||
symbolKind: TOP_LEVEL
|
|
||||||
typeParameters: []
|
|
||||||
visibility: Public
|
|
||||||
getContainingModule: KtSourceModule "Sources of main"
|
|
||||||
deprecationStatus: null
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Foo {
|
class Foo {
|
||||||
val p: (kotlin.Nothing..kotlin.Any?)
|
val p: dynamic
|
||||||
|
|
||||||
fun f(p: (kotlin.Nothing..kotlin.Any?)): (kotlin.Nothing..kotlin.Any?)
|
fun f(p: dynamic): dynamic
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,20 +30,8 @@ fun ConeKotlinType.render(): String {
|
|||||||
is ConeLookupTagBasedType -> {
|
is ConeLookupTagBasedType -> {
|
||||||
"${renderAttributes()}${lookupTag.name.asString()}"
|
"${renderAttributes()}${lookupTag.name.asString()}"
|
||||||
}
|
}
|
||||||
is ConeDynamicType -> {
|
is ConeDynamicType -> "dynamic"
|
||||||
buildString {
|
is ConeFlexibleType -> this.render()
|
||||||
append("dynamic")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
is ConeFlexibleType -> {
|
|
||||||
buildString {
|
|
||||||
append("ft<")
|
|
||||||
append(lowerBound.render())
|
|
||||||
append(", ")
|
|
||||||
append(upperBound.render())
|
|
||||||
append(">")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
is ConeIntersectionType -> {
|
is ConeIntersectionType -> {
|
||||||
intersectedTypes.joinToString(
|
intersectedTypes.joinToString(
|
||||||
separator = " & ",
|
separator = " & ",
|
||||||
@@ -59,6 +47,15 @@ fun ConeKotlinType.render(): String {
|
|||||||
} + nullabilitySuffix
|
} + nullabilitySuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun ConeFlexibleType.render(): String =
|
||||||
|
buildString {
|
||||||
|
append("ft<")
|
||||||
|
append(lowerBound.render())
|
||||||
|
append(", ")
|
||||||
|
append(upperBound.render())
|
||||||
|
append(">")
|
||||||
|
}
|
||||||
|
|
||||||
private fun ConeKotlinType.renderAttributes(): String {
|
private fun ConeKotlinType.renderAttributes(): String {
|
||||||
if (!attributes.any()) return ""
|
if (!attributes.any()) return ""
|
||||||
return attributes.joinToString(" ", postfix = " ") { it.toString() }
|
return attributes.joinToString(" ", postfix = " ") { it.toString() }
|
||||||
|
|||||||
Reference in New Issue
Block a user