From 82d934d873a5296ddef0ad2e8aaaef7acd7bd417 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Tue, 10 Jan 2023 17:41:08 +0100 Subject: [PATCH] [LL FIR] fix typo in LLFirModuleData.friendDependencies ^KTIJ-23347 Fixed --- .../fir/project/structure/LLFirModuleData.kt | 2 +- ...CompilerTestFE10TestdataTestGenerated.java | 12 ++++++ ...irOldFrontendDiagnosticsTestGenerated.java | 12 ++++++ ...DiagnosticsWithLightTreeTestGenerated.java | 12 ++++++ .../tests/multimodule/friendModule.kt | 37 +++++++++++++++++++ .../tests/multimodule/friendModule.txt | 37 +++++++++++++++++++ .../multimodule/friendModulePrivate.fir.kt | 35 ++++++++++++++++++ .../tests/multimodule/friendModulePrivate.kt | 36 ++++++++++++++++++ .../tests/multimodule/friendModulePrivate.txt | 37 +++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 12 ++++++ 10 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/diagnostics/tests/multimodule/friendModule.kt create mode 100644 compiler/testData/diagnostics/tests/multimodule/friendModule.txt create mode 100644 compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt create mode 100644 compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.txt diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/project/structure/LLFirModuleData.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/project/structure/LLFirModuleData.kt index cb102a02897..a78287c0e6e 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/project/structure/LLFirModuleData.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/project/structure/LLFirModuleData.kt @@ -44,7 +44,7 @@ class LLFirModuleData( } override val friendDependencies: List by lazy(LazyThreadSafetyMode.PUBLICATION) { - ktModule.directRefinementDependencies.map(::LLFirModuleData) + ktModule.directFriendDependencies.map(::LLFirModuleData) } override val platform: TargetPlatform get() = ktModule.platform diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index f389a3fec1d..6d27041339c 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -20836,6 +20836,18 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multimodule"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("friendModule.kt") + public void testFriendModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModule.kt"); + } + + @Test + @TestMetadata("friendModulePrivate.kt") + public void testFriendModulePrivate() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt"); + } + @Test @TestMetadata("internal.kt") public void testInternal() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index c0e57280110..3428458d32b 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -20842,6 +20842,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multimodule"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("friendModule.kt") + public void testFriendModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModule.kt"); + } + + @Test + @TestMetadata("friendModulePrivate.kt") + public void testFriendModulePrivate() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt"); + } + @Test @TestMetadata("internal.kt") public void testInternal() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index ea0d8a23a1a..fed9ba34e64 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -20836,6 +20836,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multimodule"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("friendModule.kt") + public void testFriendModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModule.kt"); + } + + @Test + @TestMetadata("friendModulePrivate.kt") + public void testFriendModulePrivate() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt"); + } + @Test @TestMetadata("internal.kt") public void testInternal() throws Exception { diff --git a/compiler/testData/diagnostics/tests/multimodule/friendModule.kt b/compiler/testData/diagnostics/tests/multimodule/friendModule.kt new file mode 100644 index 00000000000..9bbcb36dcd2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multimodule/friendModule.kt @@ -0,0 +1,37 @@ +// FIR_IDENTICAL +// !DIAGNOSTICS: -UNUSED_VARIABLE +// MODULE: m1 +// FILE: a.kt + +package p + +public class A { + internal val a = A() + internal var v = A() + internal fun a() = A() + internal inner class B +} + +internal val a = A() +internal var v = A() +internal fun a() = A() +internal class B + +// MODULE: m2()(m1) +// FILE: b.kt + +import p.* + +fun test() { + val _a = a + val _v = v + a() + B() + + val inst = A() + val ia = inst.a + val iv = inst.v + inst.a() + inst.B() +} + diff --git a/compiler/testData/diagnostics/tests/multimodule/friendModule.txt b/compiler/testData/diagnostics/tests/multimodule/friendModule.txt new file mode 100644 index 00000000000..0a06ca0bc8f --- /dev/null +++ b/compiler/testData/diagnostics/tests/multimodule/friendModule.txt @@ -0,0 +1,37 @@ +// -- Module: -- +package + +package p { + internal val a: p.A + internal var v: p.A + internal fun a(): p.A + + public final class A { + public constructor A() + internal final val a: p.A + internal final var v: p.A + internal final fun a(): p.A + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal final inner class B { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + internal final class B { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun test(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.fir.kt b/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.fir.kt new file mode 100644 index 00000000000..f4887c73fbe --- /dev/null +++ b/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.fir.kt @@ -0,0 +1,35 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// MODULE: m1 +// FILE: a.kt + +package p + +public class A { + private val a = A() + private var v = A() + private fun a() = A() + private inner class B +} + +private val a = A() +private var v = A() +private fun a() = A() +private class B + +// MODULE: m2()(m1) +// FILE: b.kt + +import p.* + +fun test() { + val _a = a + val _v = v + a() + B() + + val inst = A() + val ia = inst.a + val iv = inst.v + inst.a() + inst.B() +} diff --git a/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt b/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt new file mode 100644 index 00000000000..90d6f88a67a --- /dev/null +++ b/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt @@ -0,0 +1,36 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE +// MODULE: m1 +// FILE: a.kt + +package p + +public class A { + private val a = A() + private var v = A() + private fun a() = A() + private inner class B +} + +private val a = A() +private var v = A() +private fun a() = A() +private class B + +// MODULE: m2()(m1) +// FILE: b.kt + +import p.* + +fun test() { + val _a = a + val _v = v + a() + B() + + val inst = A() + val ia = inst.a + val iv = inst.v + inst.a() + inst.B() +} + diff --git a/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.txt b/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.txt new file mode 100644 index 00000000000..704d8c6bfbf --- /dev/null +++ b/compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.txt @@ -0,0 +1,37 @@ +// -- Module: -- +package + +package p { + private val a: p.A + private var v: p.A + private fun a(): p.A + + public final class A { + public constructor A() + private final val a: p.A + private final var v: p.A + private final fun a(): p.A + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + private final inner class B { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + private final class B { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +// -- Module: -- +package + +public fun test(): kotlin.Unit diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 1a6776a1423..b60a955915e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -20842,6 +20842,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multimodule"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true); } + @Test + @TestMetadata("friendModule.kt") + public void testFriendModule() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModule.kt"); + } + + @Test + @TestMetadata("friendModulePrivate.kt") + public void testFriendModulePrivate() throws Exception { + runTest("compiler/testData/diagnostics/tests/multimodule/friendModulePrivate.kt"); + } + @Test @TestMetadata("internal.kt") public void testInternal() throws Exception {