[Test] Add test for KT-62137
This commit is contained in:
committed by
Space Team
parent
fd1c885c5b
commit
c5d1c4e816
+6
@@ -38894,6 +38894,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("complexConditionWithSafeCall.kt")
|
||||
public void testComplexConditionWithSafeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/complexConditionWithSafeCall.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -38894,6 +38894,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("complexConditionWithSafeCall.kt")
|
||||
public void testComplexConditionWithSafeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/complexConditionWithSafeCall.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -38780,6 +38780,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("complexConditionWithSafeCall.kt")
|
||||
public void testComplexConditionWithSafeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/complexConditionWithSafeCall.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+6
@@ -38894,6 +38894,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("complexConditionWithSafeCall.kt")
|
||||
public void testComplexConditionWithSafeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/complexConditionWithSafeCall.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// ISSUE: KT-62137
|
||||
|
||||
class PersonDto (
|
||||
val name: String
|
||||
)
|
||||
|
||||
fun test() {
|
||||
val name: String? = null
|
||||
val person: PersonDto? = null
|
||||
|
||||
if (!name.isNullOrEmpty()) {
|
||||
name.length // Smart cast work
|
||||
}
|
||||
|
||||
if (!person?.name.isNullOrEmpty()) {
|
||||
person.name // Smart cast doesn't work
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// ISSUE: KT-62137
|
||||
|
||||
class PersonDto (
|
||||
val name: String
|
||||
)
|
||||
|
||||
fun test() {
|
||||
val name: String? = null
|
||||
val person: PersonDto? = null
|
||||
|
||||
if (!name.isNullOrEmpty()) {
|
||||
<!DEBUG_INFO_SMARTCAST!>name<!>.length // Smart cast work
|
||||
}
|
||||
|
||||
if (!person?.name.isNullOrEmpty()) {
|
||||
person<!UNSAFE_CALL!>.<!>name // Smart cast doesn't work
|
||||
}
|
||||
}
|
||||
Generated
+6
@@ -40834,6 +40834,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/contracts"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("complexConditionWithSafeCall.kt")
|
||||
public void testComplexConditionWithSafeCall() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/contracts/complexConditionWithSafeCall.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user