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()) {
|
||||
is DynamicType -> append("dynamic")
|
||||
is FlexibleType -> renderFlexibleType(unwrappedType)
|
||||
is DefinitelyNotNullType -> renderDefinitelyNotNullType(unwrappedType)
|
||||
is ErrorType -> renderErrorType()
|
||||
|
||||
+9
-3
@@ -48,7 +48,6 @@ internal class ConeTypeIdeRenderer(
|
||||
is ConeErrorType -> {
|
||||
renderErrorType(type)
|
||||
}
|
||||
//is Dynamic??? -> append("dynamic")
|
||||
is ConeClassLikeType -> {
|
||||
if (options.renderFunctionType && shouldRenderAsPrettyFunctionType(type)) {
|
||||
renderAnnotationList(type)
|
||||
@@ -70,9 +69,11 @@ internal class ConeTypeIdeRenderer(
|
||||
}
|
||||
renderNullability(type.type)
|
||||
}
|
||||
is ConeDynamicType -> {
|
||||
append("dynamic")
|
||||
}
|
||||
is ConeFlexibleType -> {
|
||||
renderAnnotationList(type)
|
||||
append(renderFlexibleType(renderType(type.lowerBound), renderType(type.upperBound)))
|
||||
renderFlexibleType(type)
|
||||
}
|
||||
is ConeCapturedType -> {
|
||||
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) {
|
||||
val diagnostic = type.diagnostic
|
||||
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 {
|
||||
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 -> {
|
||||
"${renderAttributes()}${lookupTag.name.asString()}"
|
||||
}
|
||||
is ConeDynamicType -> {
|
||||
buildString {
|
||||
append("dynamic")
|
||||
}
|
||||
}
|
||||
is ConeFlexibleType -> {
|
||||
buildString {
|
||||
append("ft<")
|
||||
append(lowerBound.render())
|
||||
append(", ")
|
||||
append(upperBound.render())
|
||||
append(">")
|
||||
}
|
||||
}
|
||||
is ConeDynamicType -> "dynamic"
|
||||
is ConeFlexibleType -> this.render()
|
||||
is ConeIntersectionType -> {
|
||||
intersectedTypes.joinToString(
|
||||
separator = " & ",
|
||||
@@ -59,6 +47,15 @@ fun ConeKotlinType.render(): String {
|
||||
} + nullabilitySuffix
|
||||
}
|
||||
|
||||
private fun ConeFlexibleType.render(): String =
|
||||
buildString {
|
||||
append("ft<")
|
||||
append(lowerBound.render())
|
||||
append(", ")
|
||||
append(upperBound.render())
|
||||
append(">")
|
||||
}
|
||||
|
||||
private fun ConeKotlinType.renderAttributes(): String {
|
||||
if (!attributes.any()) return ""
|
||||
return attributes.joinToString(" ", postfix = " ") { it.toString() }
|
||||
|
||||
Reference in New Issue
Block a user