[Test] Add test for KT-53460
This commit is contained in:
committed by
Space Team
parent
31d046e8cd
commit
5d6328a706
+6
@@ -22924,6 +22924,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/kt58844.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessComparasionAfterSmartcast.kt")
|
||||
public void testNotUselessComparasionAfterSmartcast() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/notUselessComparasionAfterSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
|
||||
+6
@@ -22924,6 +22924,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/kt58844.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessComparasionAfterSmartcast.kt")
|
||||
public void testNotUselessComparasionAfterSmartcast() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/notUselessComparasionAfterSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
|
||||
+6
@@ -22924,6 +22924,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/kt58844.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessComparasionAfterSmartcast.kt")
|
||||
public void testNotUselessComparasionAfterSmartcast() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/notUselessComparasionAfterSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
|
||||
+6
@@ -22930,6 +22930,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/kt58844.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessComparasionAfterSmartcast.kt")
|
||||
public void testNotUselessComparasionAfterSmartcast() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/notUselessComparasionAfterSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-53460
|
||||
|
||||
fun test(a: String?, b: String?) {
|
||||
if (a == null || a == "foo") {
|
||||
when (b) {
|
||||
"abc" -> return
|
||||
}
|
||||
}
|
||||
|
||||
a<!UNSAFE_CALL!>.<!>length // should be an error
|
||||
if (a == null || a == "bar") { // comparasion to null is not useless
|
||||
a<!UNSAFE_CALL!>.<!>length
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// ISSUE: KT-53460
|
||||
|
||||
fun test(a: String?, b: String?) {
|
||||
if (a == null || a == "foo") {
|
||||
when (b) {
|
||||
"abc" -> return
|
||||
}
|
||||
}
|
||||
|
||||
<!DEBUG_INFO_SMARTCAST!>a<!>.length // should be an error
|
||||
if (<!SENSELESS_COMPARISON!>a == null<!> || a == "bar") { // comparasion to null is not useless
|
||||
<!DEBUG_INFO_SMARTCAST!>a<!>.length
|
||||
}
|
||||
}
|
||||
Generated
+6
@@ -23762,6 +23762,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/kt58844.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notUselessComparasionAfterSmartcast.kt")
|
||||
public void testNotUselessComparasionAfterSmartcast() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/nullableTypes/notUselessComparasionAfterSmartcast.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullAssertOnTypeWithNullableUpperBound.kt")
|
||||
public void testNullAssertOnTypeWithNullableUpperBound() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user