[K2]: Missing error and miscompilation in destructuring declaration delegation

In convertDestructingDeclaration, property delegates are mistakenly
treated as valid expressions for destructuring, but they should be
ignored.

#KT-65021 Fixed
This commit is contained in:
Anastasia.Nekrasova
2024-01-24 22:12:00 +02:00
committed by Space Team
parent b0367d9399
commit 1d817e2ace
8 changed files with 94 additions and 0 deletions
@@ -11603,6 +11603,22 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/destructuring")
@TestDataPath("$PROJECT_ROOT")
public class Destructuring {
@Test
public void testAllFilesPresentInDestructuring() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/destructuring"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("delegationInDestructuring.kt")
public void testDelegationInDestructuring() throws Exception {
runTest("compiler/testData/diagnostics/tests/destructuring/delegationInDestructuring.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature")
@TestDataPath("$PROJECT_ROOT")
@@ -11609,6 +11609,22 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/destructuring")
@TestDataPath("$PROJECT_ROOT")
public class Destructuring {
@Test
public void testAllFilesPresentInDestructuring() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/destructuring"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("delegationInDestructuring.kt")
public void testDelegationInDestructuring() throws Exception {
runTest("compiler/testData/diagnostics/tests/destructuring/delegationInDestructuring.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/duplicateJvmSignature")
@TestDataPath("$PROJECT_ROOT")