[Test] Add test for Enum.entries shadowing when property is imported

This is similar to KT-64488 but without context receivers.
Warning message "access ... from within the enum" is also incorrect
here.

^KT-64488
This commit is contained in:
Roman Efremov
2024-02-20 17:32:16 +01:00
committed by Space Team
parent e83d2e31d4
commit 34d87465ac
7 changed files with 52 additions and 0 deletions
@@ -12825,6 +12825,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
}
@Test
@TestMetadata("entriesPropertyImport.kt")
public void testEntriesPropertyImport() {
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImport.kt");
}
@Test
@TestMetadata("entriesPropertyImportedClash.kt")
public void testEntriesPropertyImportedClash() {
@@ -12825,6 +12825,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
}
@Test
@TestMetadata("entriesPropertyImport.kt")
public void testEntriesPropertyImport() {
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImport.kt");
}
@Test
@TestMetadata("entriesPropertyImportedClash.kt")
public void testEntriesPropertyImportedClash() {
@@ -12819,6 +12819,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
}
@Test
@TestMetadata("entriesPropertyImport.kt")
public void testEntriesPropertyImport() {
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImport.kt");
}
@Test
@TestMetadata("entriesPropertyImportedClash.kt")
public void testEntriesPropertyImportedClash() {
@@ -12825,6 +12825,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
}
@Test
@TestMetadata("entriesPropertyImport.kt")
public void testEntriesPropertyImport() {
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImport.kt");
}
@Test
@TestMetadata("entriesPropertyImportedClash.kt")
public void testEntriesPropertyImportedClash() {
@@ -0,0 +1,11 @@
// !LANGUAGE: -EnumEntries -PrioritizedEnumEntries
// WITH_STDLIB
import MyEnum.entries
enum class MyEnum
val entries = "local str"
fun test() {
<!DEPRECATED_ACCESS_TO_ENTRY_PROPERTY_FROM_ENUM!>entries<!>
}
@@ -0,0 +1,11 @@
// !LANGUAGE: -EnumEntries -PrioritizedEnumEntries
// WITH_STDLIB
import MyEnum.entries
enum class MyEnum
val entries = "local str"
fun test() {
entries
}
@@ -12825,6 +12825,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyAsExtensionClashPrioritized.kt");
}
@Test
@TestMetadata("entriesPropertyImport.kt")
public void testEntriesPropertyImport() {
runTest("compiler/testData/diagnostics/tests/enum/entries/entriesPropertyImport.kt");
}
@Test
@TestMetadata("entriesPropertyImportedClash.kt")
public void testEntriesPropertyImportedClash() {