[Test] Add test for KT-45814

^KT-45814 Can't reproduce
This commit is contained in:
Dmitriy Novozhilov
2023-01-24 16:43:01 +02:00
committed by Space Team
parent a1a9a55e1a
commit d01a2c7271
6 changed files with 70 additions and 0 deletions
@@ -29542,6 +29542,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/smartCasts/kt3993.kt");
}
@Test
@TestMetadata("kt45814.kt")
public void testKt45814() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/kt45814.kt");
}
@Test
@TestMetadata("kt51460.kt")
public void testKt51460() throws Exception {
@@ -29638,6 +29638,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/smartCasts/kt3993.kt");
}
@Test
@TestMetadata("kt45814.kt")
public void testKt45814() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/kt45814.kt");
}
@Test
@TestMetadata("kt51460.kt")
public void testKt51460() throws Exception {
@@ -29542,6 +29542,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/smartCasts/kt3993.kt");
}
@Test
@TestMetadata("kt45814.kt")
public void testKt45814() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/kt45814.kt");
}
@Test
@TestMetadata("kt51460.kt")
public void testKt51460() throws Exception {
@@ -0,0 +1,23 @@
// SKIP_TXT
// ISSUE: KT-45814
class Foo(val bar: String?)
fun test_1(foo: Foo?) {
foo!!.bar.let {
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
foo.bar?.length // Correct
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
}
foo.bar?.length
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
}
fun test_2(foo: Foo?) {
foo!!.bar.let {
foo.bar?.length // Correct
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
Unit
}
foo.bar?.length
}
@@ -0,0 +1,23 @@
// SKIP_TXT
// ISSUE: KT-45814
class Foo(val bar: String?)
fun test_1(foo: Foo?) {
foo!!.bar.let {
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length // Correct
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
}
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
}
fun test_2(foo: Foo?) {
foo!!.bar.let {
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length // Correct
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
Unit
}
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length
}
@@ -29638,6 +29638,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/smartCasts/kt3993.kt");
}
@Test
@TestMetadata("kt45814.kt")
public void testKt45814() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/kt45814.kt");
}
@Test
@TestMetadata("kt51460.kt")
public void testKt51460() throws Exception {