Add test for KT-54744
This commit is contained in:
+6
@@ -30607,6 +30607,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertySubtypeInMemberCheck.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reassignedDependency.kt")
|
||||
public void testReassignedDependency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/reassignedDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("varAsUse.kt")
|
||||
public void testVarAsUse() throws Exception {
|
||||
|
||||
+6
@@ -30607,6 +30607,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertySubtypeInMemberCheck.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reassignedDependency.kt")
|
||||
public void testReassignedDependency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/reassignedDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("varAsUse.kt")
|
||||
public void testVarAsUse() throws Exception {
|
||||
|
||||
+6
@@ -30607,6 +30607,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertySubtypeInMemberCheck.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reassignedDependency.kt")
|
||||
public void testReassignedDependency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/reassignedDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("varAsUse.kt")
|
||||
public void testVarAsUse() throws Exception {
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// SKIP_TXT
|
||||
|
||||
class C(val x: String?)
|
||||
|
||||
fun test1() {
|
||||
var c = C("...")
|
||||
val x = c.x
|
||||
if (x == null) return
|
||||
x.length // ok
|
||||
c.x.length // ok
|
||||
c = C(null)
|
||||
x<!UNSAFE_CALL!>.<!>length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // bad
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
var c = C("...")
|
||||
val x = c.x
|
||||
if (x == null) return
|
||||
while (true) {
|
||||
x<!UNSAFE_CALL!>.<!>length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // bad
|
||||
c = C(null)
|
||||
x<!UNSAFE_CALL!>.<!>length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // bad
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(p: Boolean) {
|
||||
var c = C("...")
|
||||
val x = c.x
|
||||
if (x == null) return
|
||||
x.length // ok
|
||||
c.x.length // ok
|
||||
if (p) {
|
||||
c = C(null)
|
||||
}
|
||||
x.length // ok
|
||||
c.x.length // bad
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// SKIP_TXT
|
||||
|
||||
class C(val x: String?)
|
||||
|
||||
fun test1() {
|
||||
var c = C("...")
|
||||
val x = c.x
|
||||
if (x == null) return
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // ok
|
||||
c = C(null)
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // bad
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
var c = C("...")
|
||||
val x = c.x
|
||||
if (x == null) return
|
||||
while (true) {
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // bad
|
||||
c = C(null)
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // bad
|
||||
}
|
||||
}
|
||||
|
||||
fun test3(p: Boolean) {
|
||||
var c = C("...")
|
||||
val x = c.x
|
||||
if (x == null) return
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // ok
|
||||
if (p) {
|
||||
c = C(null)
|
||||
}
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length // ok
|
||||
c.x<!UNSAFE_CALL!>.<!>length // bad
|
||||
}
|
||||
Generated
+6
@@ -30697,6 +30697,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/propertySubtypeInMemberCheck.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reassignedDependency.kt")
|
||||
public void testReassignedDependency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/smartCasts/variables/reassignedDependency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("varAsUse.kt")
|
||||
public void testVarAsUse() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user