diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt index 2f7a5a82963..78ece4fb42e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/extensions/FirPredicateBasedProviderImpl.kt @@ -215,12 +215,13 @@ fun FirRegularClassSymbol?.markedWithMetaAnnotationImpl( session: FirSession, metaAnnotations: Set, includeItself: Boolean, - visited: MutableSet + visited: MutableSet, + resolvedCompilerAnnotations: (FirRegularClassSymbol) -> List = FirBasedSymbol<*>::resolvedCompilerAnnotationsWithClassIds, ): Boolean { if (this == null) return false if (!visited.add(this)) return false if (this.classId.asSingleFqName() in metaAnnotations) return includeItself - return this.resolvedCompilerAnnotationsWithClassIds + return resolvedCompilerAnnotations(this) .mapNotNull { it.annotationTypeRef.coneTypeSafe()?.toRegularClassSymbol(session) } - .any { it.markedWithMetaAnnotationImpl(session, metaAnnotations, includeItself = true, visited) } + .any { it.markedWithMetaAnnotationImpl(session, metaAnnotations, includeItself = true, visited, resolvedCompilerAnnotations) } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt index 1cc86f853bf..2809be8dc26 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt @@ -276,7 +276,10 @@ abstract class AbstractFirSpecificAnnotationResolveTransformer( } private fun ConeKotlinType.markedWithMetaAnnotation(session: FirSession, metaAnnotations: Set): Boolean { - return toRegularClassSymbol(session).markedWithMetaAnnotationImpl(session, metaAnnotations, includeItself = true, mutableSetOf()) + return toRegularClassSymbol(session).markedWithMetaAnnotationImpl(session, metaAnnotations, includeItself = true, mutableSetOf()) { + computationSession.resolveAnnotationsOnAnnotationIfNeeded(it, scopeSession) + it.annotations + } } diff --git a/plugins/allopen/testData/diagnostics/kt60448.kt b/plugins/allopen/testData/diagnostics/kt60448.kt new file mode 100644 index 00000000000..4c7be0aa471 --- /dev/null +++ b/plugins/allopen/testData/diagnostics/kt60448.kt @@ -0,0 +1,9 @@ +// FIR_IDENTICAL +// WITH_STDLIB +annotation class AllOpen + +@AllOpen +class Test { + @JvmName("g") + private fun f() {} +} diff --git a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java index c4beddfc1ec..de1387fdf6a 100644 --- a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java +++ b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/DiagnosticTestForAllOpenBaseGenerated.java @@ -30,6 +30,12 @@ public class DiagnosticTestForAllOpenBaseGenerated extends AbstractDiagnosticTes runTest("plugins/allopen/testData/diagnostics/kt54260.kt"); } + @Test + @TestMetadata("kt60448.kt") + public void testKt60448() throws Exception { + runTest("plugins/allopen/testData/diagnostics/kt60448.kt"); + } + @Test @TestMetadata("smartcast.kt") public void testSmartcast() throws Exception { diff --git a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java index 7c87b5361bb..73c5822fa8e 100644 --- a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java +++ b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirLightTreeDiagnosticTestForAllOpenGenerated.java @@ -30,6 +30,12 @@ public class FirLightTreeDiagnosticTestForAllOpenGenerated extends AbstractFirLi runTest("plugins/allopen/testData/diagnostics/kt54260.kt"); } + @Test + @TestMetadata("kt60448.kt") + public void testKt60448() throws Exception { + runTest("plugins/allopen/testData/diagnostics/kt60448.kt"); + } + @Test @TestMetadata("smartcast.kt") public void testSmartcast() throws Exception { diff --git a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java index dc51fb43d0a..e6c4612cf8a 100644 --- a/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java +++ b/plugins/allopen/tests-gen/org/jetbrains/kotlin/allopen/FirPsiDiagnosticTestForAllOpenGenerated.java @@ -30,6 +30,12 @@ public class FirPsiDiagnosticTestForAllOpenGenerated extends AbstractFirPsiDiagn runTest("plugins/allopen/testData/diagnostics/kt54260.kt"); } + @Test + @TestMetadata("kt60448.kt") + public void testKt60448() throws Exception { + runTest("plugins/allopen/testData/diagnostics/kt60448.kt"); + } + @Test @TestMetadata("smartcast.kt") public void testSmartcast() throws Exception { diff --git a/plugins/fir-plugin-prototype/testData/box/expectComposableFunction.kt b/plugins/fir-plugin-prototype/testData/box/expectComposableFunction.kt index 9b8d685f204..4f6ba43decb 100644 --- a/plugins/fir-plugin-prototype/testData/box/expectComposableFunction.kt +++ b/plugins/fir-plugin-prototype/testData/box/expectComposableFunction.kt @@ -1,4 +1,3 @@ -// FIR_DISABLE_LAZY_RESOLVE_CHECKS // LANGUAGE: +MultiPlatformProjects // ISSUE: KT-58539 diff --git a/plugins/fir-plugin-prototype/testData/box/metaAnnotationFromLibrary.kt b/plugins/fir-plugin-prototype/testData/box/metaAnnotationFromLibrary.kt index 8788e16199a..2df4b8312cc 100644 --- a/plugins/fir-plugin-prototype/testData/box/metaAnnotationFromLibrary.kt +++ b/plugins/fir-plugin-prototype/testData/box/metaAnnotationFromLibrary.kt @@ -1,4 +1,3 @@ -// FIR_DISABLE_LAZY_RESOLVE_CHECKS // MODULE: lib import org.jetbrains.kotlin.fir.plugin.AllOpen diff --git a/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotation.kt b/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotation.kt index 3a8cba90cba..dc1c7df4046 100644 --- a/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotation.kt +++ b/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotation.kt @@ -1,4 +1,3 @@ -// FIR_DISABLE_LAZY_RESOLVE_CHECKS // FILE: first.kt @Open diff --git a/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotationClashesWithSupertype.kt b/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotationClashesWithSupertype.kt index 9ce5617cbcb..529f9db9fd4 100644 --- a/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotationClashesWithSupertype.kt +++ b/plugins/fir-plugin-prototype/testData/diagnostics/status/metaAnnotationClashesWithSupertype.kt @@ -1,4 +1,3 @@ -// FIR_DISABLE_LAZY_RESOLVE_CHECKS import org.jetbrains.kotlin.fir.plugin.AllOpen @AllOpen diff --git a/plugins/fir-plugin-prototype/testData/diagnostics/supertypes/metaAnnotationOrder.kt b/plugins/fir-plugin-prototype/testData/diagnostics/supertypes/metaAnnotationOrder.kt index f6ade31946d..5ed5f0db0bd 100644 --- a/plugins/fir-plugin-prototype/testData/diagnostics/supertypes/metaAnnotationOrder.kt +++ b/plugins/fir-plugin-prototype/testData/diagnostics/supertypes/metaAnnotationOrder.kt @@ -1,4 +1,3 @@ -// FIR_DISABLE_LAZY_RESOLVE_CHECKS // FILE: main.kt package foo diff --git a/plugins/kotlinx-serialization/testData/diagnostics/repeatableSerialInfo.kt b/plugins/kotlinx-serialization/testData/diagnostics/repeatableSerialInfo.kt index b94cb4ef2a4..f31472609ce 100644 --- a/plugins/kotlinx-serialization/testData/diagnostics/repeatableSerialInfo.kt +++ b/plugins/kotlinx-serialization/testData/diagnostics/repeatableSerialInfo.kt @@ -1,4 +1,3 @@ -// FIR_DISABLE_LAZY_RESOLVE_CHECKS // FIR_IDENTICAL // SKIP_TXT