From 63aa8092800471d8f88b807df139a28734b67ced Mon Sep 17 00:00:00 2001 From: Igor Yakovlev Date: Thu, 17 Dec 2020 20:55:36 +0300 Subject: [PATCH] [FIR IDE] Add fir type annotations test --- .../testData/symbolsByPsi/typeAnnotations.kt | 159 ++++++++++++++++++ .../SymbolsByPsiBuildingTestGenerated.java | 5 + 2 files changed, 164 insertions(+) create mode 100644 idea/idea-frontend-fir/testData/symbolsByPsi/typeAnnotations.kt diff --git a/idea/idea-frontend-fir/testData/symbolsByPsi/typeAnnotations.kt b/idea/idea-frontend-fir/testData/symbolsByPsi/typeAnnotations.kt new file mode 100644 index 00000000000..8a9da363095 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbolsByPsi/typeAnnotations.kt @@ -0,0 +1,159 @@ + +@Target(AnnotationTarget.TYPE) +annotation class Anno1 +@Target(AnnotationTarget.TYPE) +annotation class Anno2 +@Target(AnnotationTarget.TYPE) +annotation class Anno3 +@Target(AnnotationTarget.TYPE) +annotation class Anno4 + +interface I + +class X : @Anno1 I { + fun f(arg: @Anno2 I): @Anno3 I = arg + val x: @Anno4 I = this +} + +// SYMBOLS: +/* +KtFirClassOrObjectSymbol: + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno1 + classKind: ANNOTATION_CLASS + companionObject: null + isInner: false + modality: FINAL + name: Anno1 + origin: SOURCE + primaryConstructor: KtFirConstructorSymbol() + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: PUBLIC + +KtFirClassOrObjectSymbol: + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno2 + classKind: ANNOTATION_CLASS + companionObject: null + isInner: false + modality: FINAL + name: Anno2 + origin: SOURCE + primaryConstructor: KtFirConstructorSymbol() + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: PUBLIC + +KtFirClassOrObjectSymbol: + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno3 + classKind: ANNOTATION_CLASS + companionObject: null + isInner: false + modality: FINAL + name: Anno3 + origin: SOURCE + primaryConstructor: KtFirConstructorSymbol() + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: PUBLIC + +KtFirClassOrObjectSymbol: + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno4 + classKind: ANNOTATION_CLASS + companionObject: null + isInner: false + modality: FINAL + name: Anno4 + origin: SOURCE + primaryConstructor: KtFirConstructorSymbol() + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: PUBLIC + +KtFirClassOrObjectSymbol: + annotations: [] + classIdIfNonLocal: I + classKind: INTERFACE + companionObject: null + isInner: false + modality: ABSTRACT + name: I + origin: SOURCE + primaryConstructor: null + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: PUBLIC + +KtFirFunctionValueParameterSymbol: + annotatedType: [Anno2()] I + annotations: [] + hasDefaultValue: false + isVararg: false + name: arg + origin: SOURCE + symbolKind: NON_PROPERTY_PARAMETER + +KtFirFunctionSymbol: + annotatedType: [Anno3()] I + annotations: [] + callableIdIfNonLocal: X.f + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: f + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirFunctionValueParameterSymbol(arg)] + visibility: PUBLIC + +KtFirKotlinPropertySymbol: + annotatedType: [Anno4()] I + annotations: [] + callableIdIfNonLocal: X.x + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtUnsupportedConstantValue + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: x + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + visibility: PUBLIC + +KtFirClassOrObjectSymbol: + annotations: [] + classIdIfNonLocal: X + classKind: CLASS + companionObject: null + isInner: false + modality: FINAL + name: X + origin: SOURCE + primaryConstructor: KtFirConstructorSymbol() + superTypes: [[Anno1()] I] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: PUBLIC +*/ diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java index 6a5b31bd59c..bab8fcbd38c 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolsByPsiBuildingTestGenerated.java @@ -78,4 +78,9 @@ public class SymbolsByPsiBuildingTestGenerated extends AbstractSymbolsByPsiBuild public void testLocalDeclarations() throws Exception { runTest("idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt"); } + + @TestMetadata("typeAnnotations.kt") + public void testTypeAnnotations() throws Exception { + runTest("idea/idea-frontend-fir/testData/symbolsByPsi/typeAnnotations.kt"); + } }