From 1b1e1d5b3f2d457e639645843cb5ff54b8c172aa Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Thu, 14 Sep 2023 17:54:58 +0200 Subject: [PATCH] [Analysis API] DebugSymbolRenderer: unify error types They are still can be different in the case of error inside type argument (e.g. `kotlin/Array`) --- .../api/symbols/DebugSymbolRenderer.kt | 3 +- .../scopeContextForPosition/errorType.txt | 2 +- .../parameterNotFunctionalType.txt | 4 +- ...rimaryConstructorAsPropertyWithoutType.txt | 8 +- ...maryConstructorWithoutType.descriptors.txt | 73 ------------------- ...nnotationPrimaryConstructorWithoutType.txt | 4 +- ...rimaryConstructorAsPropertyWithoutType.txt | 8 +- ...imaryConstructorAsPropertyWithoutType2.txt | 8 +- ...maryConstructorWithoutType.descriptors.txt | 73 ------------------- .../varargInPrimaryConstructorWithoutType.txt | 4 +- ...daryConstructorWithoutType.descriptors.txt | 73 ------------------- ...arargInSecondaryConstructorWithoutType.txt | 4 +- .../varargWithoutType.descriptors.txt | 53 -------------- .../valueParameters/varargWithoutType.txt | 2 +- 14 files changed, 24 insertions(+), 295 deletions(-) delete mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.descriptors.txt delete mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.descriptors.txt delete mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.descriptors.txt delete mode 100644 analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.descriptors.txt diff --git a/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/symbols/DebugSymbolRenderer.kt b/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/symbols/DebugSymbolRenderer.kt index 4419343072c..c504d239308 100644 --- a/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/symbols/DebugSymbolRenderer.kt +++ b/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/symbols/DebugSymbolRenderer.kt @@ -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()) } } diff --git a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.txt b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.txt index ddd6e58927a..b7d87d1c301 100644 --- a/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.txt +++ b/analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.txt @@ -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: diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/parameterNotFunctionalType.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/parameterNotFunctionalType.txt index 7a0d17da40f..044130acf1d 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/parameterNotFunctionalType.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/parameterNotFunctionalType.txt @@ -52,7 +52,7 @@ KtFunctionSymbol: type: ERROR_TYPE KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: Incomplete code + type: ERROR_TYPE ] type: kotlin/Function2 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" diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorAsPropertyWithoutType.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorAsPropertyWithoutType.txt index 2e1ab56a808..bc06414a3ea 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorAsPropertyWithoutType.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorAsPropertyWithoutType.txt @@ -37,7 +37,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: Incomplete code + type: ERROR_TYPE ] type: kotlin/Array symbolKind: LOCAL @@ -64,7 +64,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: Incomplete code + type: ERROR_TYPE ] type: kotlin/Array symbolKind: ACCESSOR @@ -100,7 +100,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: Incomplete code + type: ERROR_TYPE ] type: kotlin/Array 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" diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.descriptors.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.descriptors.txt deleted file mode 100644 index d24d0800a79..00000000000 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.descriptors.txt +++ /dev/null @@ -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 \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.txt index 3404311b7c8..d24d0800a79 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInAnnotationPrimaryConstructorWithoutType.txt @@ -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 \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType.txt index 32ab85c8c4e..0537350e690 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType.txt @@ -37,7 +37,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: Incomplete code + type: ERROR_TYPE ] type: kotlin/Array symbolKind: LOCAL @@ -64,7 +64,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: Incomplete code + type: ERROR_TYPE ] type: kotlin/Array symbolKind: ACCESSOR @@ -100,7 +100,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: Incomplete code + type: ERROR_TYPE ] type: kotlin/Array 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" diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType2.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType2.txt index ee9b948c77e..b8f197ee8df 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType2.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorAsPropertyWithoutType2.txt @@ -37,7 +37,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: No type for parameter + type: ERROR_TYPE ] type: kotlin/Array symbolKind: LOCAL @@ -64,7 +64,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: No type for parameter + type: ERROR_TYPE ] type: kotlin/Array symbolKind: ACCESSOR @@ -100,7 +100,7 @@ KtConstructorSymbol: ownTypeArguments: [ out KtTypeErrorType: annotationsList: [] - type: ERROR CLASS: No type for parameter + type: ERROR_TYPE ] type: kotlin/Array 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" diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.descriptors.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.descriptors.txt deleted file mode 100644 index 868d8fa5e83..00000000000 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.descriptors.txt +++ /dev/null @@ -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 \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.txt index 3bda681e545..868d8fa5e83 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInPrimaryConstructorWithoutType.txt @@ -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 \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.descriptors.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.descriptors.txt deleted file mode 100644 index d4f13e006d9..00000000000 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.descriptors.txt +++ /dev/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 \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.txt index bf9c0b785ef..d4f13e006d9 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargInSecondaryConstructorWithoutType.txt @@ -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 \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.descriptors.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.descriptors.txt deleted file mode 100644 index 90a09e810d1..00000000000 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.descriptors.txt +++ /dev/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 \ No newline at end of file diff --git a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.txt b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.txt index 3bae8379e95..90a09e810d1 100644 --- a/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.txt +++ b/analysis/analysis-api/testData/symbols/symbolByPsi/valueParameters/varargWithoutType.txt @@ -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"