[Analysis API] DebugSymbolRenderer: unify error types

They are still can be different in the case of error inside
type argument (e.g. `kotlin/Array<out ERROR CLASS: Incomplete code>`)
This commit is contained in:
Dmitrii Gridin
2023-09-14 17:54:58 +02:00
parent 2d83509200
commit 1b1e1d5b3f
14 changed files with 24 additions and 295 deletions
@@ -18,6 +18,7 @@ import org.jetbrains.kotlin.analysis.api.symbols.markers.KtNamedSymbol
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtPossiblyNamedSymbol
import org.jetbrains.kotlin.analysis.api.types.KtClassErrorType
import org.jetbrains.kotlin.analysis.api.types.KtClassTypeQualifier
import org.jetbrains.kotlin.analysis.api.types.KtErrorType
import org.jetbrains.kotlin.analysis.api.types.KtNonErrorClassType
import org.jetbrains.kotlin.analysis.api.types.KtType
import org.jetbrains.kotlin.analysis.project.structure.KtModule
@@ -226,7 +227,7 @@ public class DebugSymbolRenderer(
appendLine()
append("type: ")
when (typeToRender) {
is KtClassErrorType -> append("ERROR_TYPE")
is KtErrorType -> append("ERROR_TYPE")
else -> append(typeToRender.asStringForDebugging())
}
}
@@ -2,7 +2,7 @@ element: e
implicit receivers:
type: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Cannot infer argument for type parameter T
type: ERROR_TYPE
owner symbol: KtFirAnonymousFunctionSymbol
scopes:
@@ -52,7 +52,7 @@ KtFunctionSymbol:
type: ERROR_TYPE
KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
]
type: kotlin/Function2<kotlin/Int, ERROR CLASS: Symbol not found for p2, ERROR CLASS: Incomplete code>
symbolKind: LOCAL
@@ -75,7 +75,7 @@ KtFunctionSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: No type for parameter
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
@@ -37,7 +37,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: Incomplete code>
symbolKind: LOCAL
@@ -64,7 +64,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: Incomplete code>
symbolKind: ACCESSOR
@@ -100,7 +100,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: Incomplete code>
setter: null
@@ -128,7 +128,7 @@ KtConstructorSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
@@ -1,73 +0,0 @@
KtConstructorSymbol:
annotationsList: []
callableIdIfNonLocal: null
containingClassIdIfNonLocal: Foo
contextReceivers: []
hasStableParameterNames: true
isActual: false
isExpect: false
isExtension: false
isPrimary: true
origin: SOURCE
receiverParameter: null
returnType: KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: Foo
symbolKind: CLASS_MEMBER
typeParameters: []
valueParameters: [
KtValueParameterSymbol:
annotationsList: []
callableIdIfNonLocal: null
contextReceivers: []
generatedPrimaryConstructorProperty: null
hasDefaultValue: false
isCrossinline: false
isExtension: false
isImplicitLambdaParameter: false
isNoinline: false
isVararg: true
name: ints
origin: SOURCE
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
]
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
KtNamedClassOrObjectSymbol:
annotationsList: []
classIdIfNonLocal: Foo
classKind: ANNOTATION_CLASS
companionObject: null
contextReceivers: []
isActual: false
isData: false
isExpect: false
isExternal: false
isFun: false
isInline: false
isInner: false
modality: FINAL
name: Foo
origin: SOURCE
superTypes: [
KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: kotlin/Annotation
]
symbolKind: TOP_LEVEL
typeParameters: []
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
annotationApplicableTargets: [CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, BACKING_FIELD]
deprecationStatus: null
@@ -33,7 +33,7 @@ KtConstructorSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
@@ -70,4 +70,4 @@ KtNamedClassOrObjectSymbol:
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
annotationApplicableTargets: [CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, BACKING_FIELD]
deprecationStatus: null
deprecationStatus: null
@@ -37,7 +37,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: Incomplete code>
symbolKind: LOCAL
@@ -64,7 +64,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: Incomplete code>
symbolKind: ACCESSOR
@@ -100,7 +100,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: Incomplete code>
setter: null
@@ -128,7 +128,7 @@ KtConstructorSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
@@ -37,7 +37,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: No type for parameter
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: No type for parameter>
symbolKind: LOCAL
@@ -64,7 +64,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: No type for parameter
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: No type for parameter>
symbolKind: ACCESSOR
@@ -100,7 +100,7 @@ KtConstructorSymbol:
ownTypeArguments: [
out KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: No type for parameter
type: ERROR_TYPE
]
type: kotlin/Array<out ERROR CLASS: No type for parameter>
setter: null
@@ -128,7 +128,7 @@ KtConstructorSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: No type for parameter
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
@@ -1,73 +0,0 @@
KtConstructorSymbol:
annotationsList: []
callableIdIfNonLocal: null
containingClassIdIfNonLocal: Foo
contextReceivers: []
hasStableParameterNames: true
isActual: false
isExpect: false
isExtension: false
isPrimary: true
origin: SOURCE
receiverParameter: null
returnType: KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: Foo
symbolKind: CLASS_MEMBER
typeParameters: []
valueParameters: [
KtValueParameterSymbol:
annotationsList: []
callableIdIfNonLocal: null
contextReceivers: []
generatedPrimaryConstructorProperty: null
hasDefaultValue: false
isCrossinline: false
isExtension: false
isImplicitLambdaParameter: false
isNoinline: false
isVararg: true
name: ints
origin: SOURCE
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
]
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
KtNamedClassOrObjectSymbol:
annotationsList: []
classIdIfNonLocal: Foo
classKind: CLASS
companionObject: null
contextReceivers: []
isActual: false
isData: false
isExpect: false
isExternal: false
isFun: false
isInline: false
isInner: false
modality: FINAL
name: Foo
origin: SOURCE
superTypes: [
KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: kotlin/Any
]
symbolKind: TOP_LEVEL
typeParameters: []
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
annotationApplicableTargets: null
deprecationStatus: null
@@ -33,7 +33,7 @@ KtConstructorSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
@@ -70,4 +70,4 @@ KtNamedClassOrObjectSymbol:
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
annotationApplicableTargets: null
deprecationStatus: null
deprecationStatus: null
@@ -1,73 +0,0 @@
KtConstructorSymbol:
annotationsList: []
callableIdIfNonLocal: null
containingClassIdIfNonLocal: Foo
contextReceivers: []
hasStableParameterNames: true
isActual: false
isExpect: false
isExtension: false
isPrimary: false
origin: SOURCE
receiverParameter: null
returnType: KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: Foo
symbolKind: CLASS_MEMBER
typeParameters: []
valueParameters: [
KtValueParameterSymbol:
annotationsList: []
callableIdIfNonLocal: null
contextReceivers: []
generatedPrimaryConstructorProperty: null
hasDefaultValue: false
isCrossinline: false
isExtension: false
isImplicitLambdaParameter: false
isNoinline: false
isVararg: true
name: ints
origin: SOURCE
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
]
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
KtNamedClassOrObjectSymbol:
annotationsList: []
classIdIfNonLocal: Foo
classKind: CLASS
companionObject: null
contextReceivers: []
isActual: false
isData: false
isExpect: false
isExternal: false
isFun: false
isInline: false
isInner: false
modality: FINAL
name: Foo
origin: SOURCE
superTypes: [
KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: kotlin/Any
]
symbolKind: TOP_LEVEL
typeParameters: []
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
annotationApplicableTargets: null
deprecationStatus: null
@@ -33,7 +33,7 @@ KtConstructorSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
@@ -70,4 +70,4 @@ KtNamedClassOrObjectSymbol:
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
annotationApplicableTargets: null
deprecationStatus: null
deprecationStatus: null
@@ -1,53 +0,0 @@
KtFunctionSymbol:
annotationsList: []
callableIdIfNonLocal: /foo
contextReceivers: []
contractEffects: []
hasStableParameterNames: true
isActual: false
isBuiltinFunctionInvoke: false
isExpect: false
isExtension: false
isExternal: false
isInfix: false
isInline: false
isOperator: false
isOverride: false
isStatic: false
isSuspend: false
modality: FINAL
name: foo
origin: SOURCE
receiverParameter: null
returnType: KtUsualClassType:
annotationsList: []
ownTypeArguments: []
type: kotlin/Unit
symbolKind: TOP_LEVEL
typeParameters: []
valueParameters: [
KtValueParameterSymbol:
annotationsList: []
callableIdIfNonLocal: null
contextReceivers: []
generatedPrimaryConstructorProperty: null
hasDefaultValue: false
isCrossinline: false
isExtension: false
isImplicitLambdaParameter: false
isNoinline: false
isVararg: true
name: ints
origin: SOURCE
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
]
visibility: Public
getContainingModule: KtSourceModule "Sources of main"
deprecationStatus: null
@@ -42,7 +42,7 @@ KtFunctionSymbol:
receiverParameter: null
returnType: KtTypeErrorType:
annotationsList: []
type: ERROR CLASS: Incomplete code
type: ERROR_TYPE
symbolKind: LOCAL
typeParameters: []
getContainingModule: KtSourceModule "Sources of main"