[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
@@ -31924,6 +31924,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
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 {
@@ -31936,6 +31942,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
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 {
@@ -32488,6 +32506,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
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 {
@@ -32518,6 +32542,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
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 {
@@ -32656,6 +32686,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
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 {
@@ -33044,6 +33080,46 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
}
}
@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$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@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")
@@ -33563,6 +33639,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
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 {
@@ -32044,6 +32044,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
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 {
@@ -32056,6 +32062,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
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 {
@@ -32608,6 +32626,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
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 {
@@ -32638,6 +32662,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
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 {
@@ -32776,6 +32806,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
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 {
@@ -33164,6 +33200,46 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
}
}
@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("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@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")
@@ -33683,6 +33759,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
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 {