[FIR] Add a test for KT-26045

^KT-26045 Fixed

Merge-request: KT-MR-13023
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
This commit is contained in:
Nikolay Lunyak
2023-11-15 07:52:11 +00:00
committed by Space Team
parent 951830fcef
commit 9e57aba448
7 changed files with 55 additions and 0 deletions
@@ -58,6 +58,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/AbstractInTrait.kt");
}
@Test
@TestMetadata("addTestForFalsePositiveDuplicateLabelInWhen.kt")
public void testAddTestForFalsePositiveDuplicateLabelInWhen() throws Exception {
runTest("compiler/testData/diagnostics/tests/addTestForFalsePositiveDuplicateLabelInWhen.kt");
}
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
@@ -58,6 +58,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/AbstractInTrait.kt");
}
@Test
@TestMetadata("addTestForFalsePositiveDuplicateLabelInWhen.kt")
public void testAddTestForFalsePositiveDuplicateLabelInWhen() throws Exception {
runTest("compiler/testData/diagnostics/tests/addTestForFalsePositiveDuplicateLabelInWhen.kt");
}
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
@@ -58,6 +58,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/AbstractInTrait.kt");
}
@Test
@TestMetadata("addTestForFalsePositiveDuplicateLabelInWhen.kt")
public void testAddTestForFalsePositiveDuplicateLabelInWhen() throws Exception {
runTest("compiler/testData/diagnostics/tests/addTestForFalsePositiveDuplicateLabelInWhen.kt");
}
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
@@ -58,6 +58,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/AbstractInTrait.kt");
}
@Test
@TestMetadata("addTestForFalsePositiveDuplicateLabelInWhen.kt")
public void testAddTestForFalsePositiveDuplicateLabelInWhen() throws Exception {
runTest("compiler/testData/diagnostics/tests/addTestForFalsePositiveDuplicateLabelInWhen.kt");
}
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
@@ -0,0 +1,13 @@
// ISSUE: KT-26045
class _Class {
val prop_1 = 1
}
fun case_1(value: Int?, value1: _Class, value2: _Class?) {
when (value) {
value1.prop_1, value2?.prop_1 -> {}
10 -> {}
}
}
@@ -0,0 +1,12 @@
// ISSUE: KT-26045
class _Class {
val prop_1 = 1
}
fun case_1(value: Int?, value1: _Class, value2: _Class?) {
when (value) {
value1.prop_1, <!DUPLICATE_LABEL_IN_WHEN!>value2?.prop_1<!> -> {}
10 -> {}
}
}
@@ -58,6 +58,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/AbstractInTrait.kt");
}
@Test
@TestMetadata("addTestForFalsePositiveDuplicateLabelInWhen.kt")
public void testAddTestForFalsePositiveDuplicateLabelInWhen() throws Exception {
runTest("compiler/testData/diagnostics/tests/addTestForFalsePositiveDuplicateLabelInWhen.kt");
}
@Test
public void testAllFilesPresentInTests() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);