diff --git a/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt b/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt index bc3bc9728a6..ea55882c4c5 100644 --- a/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt +++ b/compiler/testData/asJava/lightClasses/TypePararametersInClass.kt @@ -8,4 +8,3 @@ abstract class A> : B>(), C { inner class Inner2 : Inner(), C } -// FIR_COMPARISON \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirNamedClassOrObjectSymbol.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirNamedClassOrObjectSymbol.kt index c19e60d1dc4..9456b5e2553 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirNamedClassOrObjectSymbol.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/symbols/KtFirNamedClassOrObjectSymbol.kt @@ -69,7 +69,7 @@ internal class KtFirNamedClassOrObjectSymbol( } override val typeParameters by firRef.withFirAndCache { fir -> - fir.typeParameters.map { typeParameter -> + fir.typeParameters.filterIsInstance().map { typeParameter -> builder.classifierBuilder.buildTypeParameterSymbol(typeParameter.symbol.fir) } } diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.kt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.kt new file mode 100644 index 00000000000..fab6c6ec6b1 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.kt @@ -0,0 +1,198 @@ +class X { + inner class Y + class Z + + fun foo() { + class U { + inner class K + class C + } + } +} + +// RESULT +/* +KtFirTypeParameterSymbol: + isReified: false + name: T + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeParameterSymbol: + isReified: false + name: T1 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X.Y + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: true + modality: FINAL + name: Y + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: MEMBER + typeParameters: [KtFirTypeParameterSymbol(T1)] + visibility: Public + +KtFirTypeParameterSymbol: + isReified: false + name: T2 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X.Z + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Z + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: MEMBER + typeParameters: [KtFirTypeParameterSymbol(T2)] + visibility: Public + +KtFirTypeParameterSymbol: + isReified: false + name: T3 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeParameterSymbol: + isReified: false + name: T4 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeParameterSymbol: + isReified: false + name: T5 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: true + modality: FINAL + name: K + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: LOCAL + typeParameters: [KtFirTypeParameterSymbol(T5)] + visibility: Local + +KtFirTypeParameterSymbol: + isReified: false + name: T6 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: C + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: LOCAL + typeParameters: [KtFirTypeParameterSymbol(T6)] + visibility: Local + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: U + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: LOCAL + typeParameters: [KtFirTypeParameterSymbol(T4)] + visibility: Local + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /X.foo + dispatchType: X + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: foo + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [KtFirTypeParameterSymbol(T3)] + valueParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: X + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + visibility: Public +*/ diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolByPsiTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolByPsiTestGenerated.java index 28062ee6b45..f2782d113fa 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolByPsiTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/SymbolByPsiTestGenerated.java @@ -104,6 +104,11 @@ public class SymbolByPsiTestGenerated extends AbstractSymbolByPsiTest { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberProperties.kt"); } + @TestMetadata("outerAndInnerClasses.kt") + public void testOuterAndInnerClasses() throws Exception { + runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.kt"); + } + @TestMetadata("topLevelFunctions.kt") public void testTopLevelFunctions() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelFunctions.kt");