diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 5b3fe5a5c22..5c83cd8a5e3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -30755,6 +30755,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/multiplatform/annotationsViaActualTypeAliasFromBinary.kt"); } + @Test + @TestMetadata("commonInternal.kt") + public void testCommonInternal() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/commonInternal.kt"); + } + @Test @TestMetadata("expectClassInJvmMultifileFacade.kt") public void testExpectClassInJvmMultifileFacade() throws Exception { diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/FirVisibilityChecker.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/FirVisibilityChecker.kt index 689e630acea..adc07e3bd65 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/FirVisibilityChecker.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/FirVisibilityChecker.kt @@ -33,8 +33,13 @@ abstract class FirModuleVisibilityChecker : FirSessionComponent { class Standard(val session: FirSession) : FirModuleVisibilityChecker() { override fun isInFriendModule(declaration: FirMemberDeclaration): Boolean { val useSiteModuleData = session.moduleData - val declarationModuleData = declaration.moduleData - return useSiteModuleData == declarationModuleData || declarationModuleData in useSiteModuleData.friendDependencies + return when (declaration.moduleData) { + useSiteModuleData, + in useSiteModuleData.friendDependencies, + in useSiteModuleData.dependsOnDependencies -> true + + else -> false + } } } } @@ -477,4 +482,4 @@ fun FirBasedSymbol<*>.getOwnerLookupTag(): ConeClassLikeLookupTag? { fun FirBasedSymbol<*>.isVariableOrNamedFunction(): Boolean { return this is FirVariableSymbol || this is FirNamedFunctionSymbol || this is FirPropertyAccessorSymbol -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/multiplatform/commonInternal.kt b/compiler/testData/codegen/box/multiplatform/commonInternal.kt new file mode 100644 index 00000000000..168bb3656d1 --- /dev/null +++ b/compiler/testData/codegen/box/multiplatform/commonInternal.kt @@ -0,0 +1,16 @@ +// TARGET_BACKEND: JVM +// MODULE: common +// FILE: commonMain.kt +internal annotation class AnnInCommon + +// MODULE: friend +// FILE: friendMain.kt +internal annotation class AnnInFriend + +// MODULE: main()(friend)(common) +// FILE: main.kt +@AnnInCommon +@AnnInFriend +class A + +fun box() = "OK" diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 6f2f824250e..564c2a39658 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -30311,6 +30311,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/multiplatform/annotationsViaActualTypeAliasFromBinary.kt"); } + @Test + @TestMetadata("commonInternal.kt") + public void testCommonInternal() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/commonInternal.kt"); + } + @Test @TestMetadata("expectClassInJvmMultifileFacade.kt") public void testExpectClassInJvmMultifileFacade() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 36f135122d3..cc7a68e3256 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -30755,6 +30755,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/multiplatform/annotationsViaActualTypeAliasFromBinary.kt"); } + @Test + @TestMetadata("commonInternal.kt") + public void testCommonInternal() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/commonInternal.kt"); + } + @Test @TestMetadata("expectClassInJvmMultifileFacade.kt") public void testExpectClassInJvmMultifileFacade() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 3b07ccff82b..b939be1b832 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -25776,6 +25776,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/multiplatform/annotationsViaActualTypeAliasFromBinary.kt"); } + @TestMetadata("commonInternal.kt") + public void testCommonInternal() throws Exception { + runTest("compiler/testData/codegen/box/multiplatform/commonInternal.kt"); + } + @TestMetadata("expectClassInJvmMultifileFacade.kt") public void testExpectClassInJvmMultifileFacade() throws Exception { runTest("compiler/testData/codegen/box/multiplatform/expectClassInJvmMultifileFacade.kt");