[Test] Add diagnostic tests for smartcast in K2

List of issues:
KT-28806, KT-7186, KT-22997, KT-1982, KT-22996, KT-54443, KT-37308, KT-37115, KT-4113, KT-25747, KT-24779
This commit is contained in:
Aleksandra.Arsenteva
2023-11-28 16:50:14 +03:00
committed by Space Team
parent 48072c822b
commit c6b32200df
27 changed files with 3802 additions and 0 deletions
@@ -34156,6 +34156,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/smartCasts/alwaysNullWithJava.kt");
}
@Test
@TestMetadata("binaryOperatorsWithJumps.kt")
public void testBinaryOperatorsWithJumps() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/binaryOperatorsWithJumps.kt");
}
@Test
@TestMetadata("classObjectMember.kt")
public void testClassObjectMember() throws Exception {
@@ -34168,6 +34174,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt");
}
@Test
@TestMetadata("comparisonOfBuiltInTypesUnderOr.kt")
public void testComparisonOfBuiltInTypesUnderOr() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/comparisonOfBuiltInTypesUnderOr.kt");
}
@Test
@TestMetadata("comparisonOfClassTypesUnderOr.kt")
public void testComparisonOfClassTypesUnderOr() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/comparisonOfClassTypesUnderOr.kt");
}
@Test
@TestMetadata("comparisonUnderAnd.kt")
public void testComparisonUnderAnd() throws Exception {
@@ -34720,6 +34738,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/smartCasts/NullableFunctionTypeAsMemberMutablePropertyFromConstructor.kt");
}
@Test
@TestMetadata("nullableLambda.kt")
public void testNullableLambda() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/nullableLambda.kt");
}
@Test
@TestMetadata("openInSealed.kt")
public void testOpenInSealed() throws Exception {
@@ -34750,6 +34774,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/smartCasts/safeAs.kt");
}
@Test
@TestMetadata("savedSmartcastResult.kt")
public void testSavedSmartcastResult() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/savedSmartcastResult.kt");
}
@Test
@TestMetadata("severalSmartCastsOnReified.kt")
public void testSeveralSmartCastsOnReified() throws Exception {
@@ -34888,6 +34918,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/smartCasts/typeInComparison.kt");
}
@Test
@TestMetadata("typeParameterWithBounds.kt")
public void testTypeParameterWithBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/typeParameterWithBounds.kt");
}
@Test
@TestMetadata("unstableToStable.kt")
public void testUnstableToStable() throws Exception {
@@ -35276,6 +35312,46 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts")
@TestDataPath("$PROJECT_ROOT")
public class LambdasWithContracts {
@Test
public void testAllFilesPresentInLambdasWithContracts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("lambdaWithCallInPlace.kt")
public void testLambdaWithCallInPlace() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlace.kt");
}
@Test
@TestMetadata("lambdaWithCallInPlaceAndBounds.kt")
public void testLambdaWithCallInPlaceAndBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlaceAndBounds.kt");
}
@Test
@TestMetadata("lambdaWithCallInPlaceAndDelegate.kt")
public void testLambdaWithCallInPlaceAndDelegate() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlaceAndDelegate.kt");
}
@Test
@TestMetadata("lambdaWithCallInPlaceAndOperators.kt")
public void testLambdaWithCallInPlaceAndOperators() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlaceAndOperators.kt");
}
@Test
@TestMetadata("lambdaWithImpliesContract.kt")
public void testLambdaWithImpliesContract() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithImpliesContract.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/smartCasts/loops")
@TestDataPath("$PROJECT_ROOT")
@@ -35795,6 +35871,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/smartCasts/safecalls/chainMixedUnsafe.kt");
}
@Test
@TestMetadata("childProperty.kt")
public void testChildProperty() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/safecalls/childProperty.kt");
}
@Test
@TestMetadata("doubleCall.kt")
public void testDoubleCall() throws Exception {
@@ -34156,6 +34156,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/smartCasts/alwaysNullWithJava.kt");
}
@Test
@TestMetadata("binaryOperatorsWithJumps.kt")
public void testBinaryOperatorsWithJumps() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/binaryOperatorsWithJumps.kt");
}
@Test
@TestMetadata("classObjectMember.kt")
public void testClassObjectMember() throws Exception {
@@ -34168,6 +34174,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/smartCasts/combineWithNoSelectorInfo.kt");
}
@Test
@TestMetadata("comparisonOfBuiltInTypesUnderOr.kt")
public void testComparisonOfBuiltInTypesUnderOr() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/comparisonOfBuiltInTypesUnderOr.kt");
}
@Test
@TestMetadata("comparisonOfClassTypesUnderOr.kt")
public void testComparisonOfClassTypesUnderOr() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/comparisonOfClassTypesUnderOr.kt");
}
@Test
@TestMetadata("comparisonUnderAnd.kt")
public void testComparisonUnderAnd() throws Exception {
@@ -34720,6 +34738,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/smartCasts/NullableFunctionTypeAsMemberMutablePropertyFromConstructor.kt");
}
@Test
@TestMetadata("nullableLambda.kt")
public void testNullableLambda() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/nullableLambda.kt");
}
@Test
@TestMetadata("openInSealed.kt")
public void testOpenInSealed() throws Exception {
@@ -34750,6 +34774,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/smartCasts/safeAs.kt");
}
@Test
@TestMetadata("savedSmartcastResult.kt")
public void testSavedSmartcastResult() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/savedSmartcastResult.kt");
}
@Test
@TestMetadata("severalSmartCastsOnReified.kt")
public void testSeveralSmartCastsOnReified() throws Exception {
@@ -34888,6 +34918,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/smartCasts/typeInComparison.kt");
}
@Test
@TestMetadata("typeParameterWithBounds.kt")
public void testTypeParameterWithBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/typeParameterWithBounds.kt");
}
@Test
@TestMetadata("unstableToStable.kt")
public void testUnstableToStable() throws Exception {
@@ -35276,6 +35312,46 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts")
@TestDataPath("$PROJECT_ROOT")
public class LambdasWithContracts {
@Test
public void testAllFilesPresentInLambdasWithContracts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("lambdaWithCallInPlace.kt")
public void testLambdaWithCallInPlace() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlace.kt");
}
@Test
@TestMetadata("lambdaWithCallInPlaceAndBounds.kt")
public void testLambdaWithCallInPlaceAndBounds() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlaceAndBounds.kt");
}
@Test
@TestMetadata("lambdaWithCallInPlaceAndDelegate.kt")
public void testLambdaWithCallInPlaceAndDelegate() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlaceAndDelegate.kt");
}
@Test
@TestMetadata("lambdaWithCallInPlaceAndOperators.kt")
public void testLambdaWithCallInPlaceAndOperators() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithCallInPlaceAndOperators.kt");
}
@Test
@TestMetadata("lambdaWithImpliesContract.kt")
public void testLambdaWithImpliesContract() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/lambdasWithContracts/lambdaWithImpliesContract.kt");
}
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/smartCasts/loops")
@TestDataPath("$PROJECT_ROOT")
@@ -35795,6 +35871,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/smartCasts/safecalls/chainMixedUnsafe.kt");
}
@Test
@TestMetadata("childProperty.kt")
public void testChildProperty() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/safecalls/childProperty.kt");
}
@Test
@TestMetadata("doubleCall.kt")
public void testDoubleCall() throws Exception {