[FE] Make whens on expect sealed classes and enums not exhaustive

This commit is contained in:
Dmitriy Novozhilov
2021-02-24 16:44:48 +03:00
parent 1cf73203c7
commit 4222bb9af2
29 changed files with 768 additions and 11 deletions
@@ -17995,6 +17995,34 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/exhaustiveness")
@TestDataPath("$PROJECT_ROOT")
public class Exhaustiveness {
@Test
public void testAllFilesPresentInExhaustiveness() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/exhaustiveness"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
}
@Test
@TestMetadata("expectEnum.kt")
public void testExpectEnum() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/exhaustiveness/expectEnum.kt");
}
@Test
@TestMetadata("expectSealedClass.kt")
public void testExpectSealedClass() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/exhaustiveness/expectSealedClass.kt");
}
@Test
@TestMetadata("expectSealedInterface.kt")
public void testExpectSealedInterface() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/exhaustiveness/expectSealedInterface.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/generic")
@TestDataPath("$PROJECT_ROOT")
@@ -24594,6 +24594,34 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/exhaustiveness")
@TestDataPath("$PROJECT_ROOT")
public class Exhaustiveness {
@Test
public void testAllFilesPresentInExhaustiveness() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/exhaustiveness"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("commonEnum.kt")
public void testCommonEnum() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/exhaustiveness/commonEnum.kt");
}
@Test
@TestMetadata("commonSealedClass.kt")
public void testCommonSealedClass() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/exhaustiveness/commonSealedClass.kt");
}
@Test
@TestMetadata("commonSealedInterface.kt")
public void testCommonSealedInterface() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/exhaustiveness/commonSealedInterface.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/multiModule")
@TestDataPath("$PROJECT_ROOT")
@@ -24594,6 +24594,34 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/exhaustiveness")
@TestDataPath("$PROJECT_ROOT")
public class Exhaustiveness {
@Test
public void testAllFilesPresentInExhaustiveness() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/exhaustiveness"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("commonEnum.kt")
public void testCommonEnum() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/exhaustiveness/commonEnum.kt");
}
@Test
@TestMetadata("commonSealedClass.kt")
public void testCommonSealedClass() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/exhaustiveness/commonSealedClass.kt");
}
@Test
@TestMetadata("commonSealedInterface.kt")
public void testCommonSealedInterface() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/exhaustiveness/commonSealedInterface.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/multiplatform/multiModule")
@TestDataPath("$PROJECT_ROOT")