[FIR] Add the privateInFileInDifferentModule test

We only see the redeclaration
diagnostics on the declarations inside
the second file, because of
`FirRecorder::visitRegularClass`.
`data.state.classifierContainerFileMap`
references the last file, so
when checking the visibility of
the first `private class C { ... }`
(when collecting declarations that
conflict with the second `private class C`)
the provider returns the second file
instead of the first one, so the class
behaves as it is visible, and
`collectTopLevelConflict` returns in
this case.

As for why `INVISIBLE_*`s are reported
inside the first file: this is because
`data.state.classifierMap` stores the
last classifier it sees instead of
the first one.

^KT-62537
This commit is contained in:
Nikolay Lunyak
2023-10-04 16:10:50 +03:00
committed by Space Team
parent ba37ad9b85
commit a9ceae9667
7 changed files with 80 additions and 0 deletions
@@ -35214,6 +35214,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/typealias/privateInFile.kt");
}
@Test
@TestMetadata("privateInFileInDifferentModule.kt")
public void testPrivateInFileInDifferentModule() throws Exception {
runTest("compiler/testData/diagnostics/tests/typealias/privateInFileInDifferentModule.kt");
}
@Test
@TestMetadata("projectionsInTypeAliasConstructor.kt")
public void testProjectionsInTypeAliasConstructor() throws Exception {
@@ -35214,6 +35214,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/typealias/privateInFile.kt");
}
@Test
@TestMetadata("privateInFileInDifferentModule.kt")
public void testPrivateInFileInDifferentModule() throws Exception {
runTest("compiler/testData/diagnostics/tests/typealias/privateInFileInDifferentModule.kt");
}
@Test
@TestMetadata("projectionsInTypeAliasConstructor.kt")
public void testProjectionsInTypeAliasConstructor() throws Exception {