[FIR] Remove dependent data flow variables after receiver reassignment
This commit is contained in:
+64
@@ -0,0 +1,64 @@
|
||||
FILE: accessToMemberAfterReceiverReassignment.kt
|
||||
public final class My : R|kotlin/Any| {
|
||||
public constructor(x: R|My?|, z: R|My?| = Null(null)): R|My| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|My?| = R|<local>/x|
|
||||
public get(): R|My?|
|
||||
|
||||
public final val z: R|My?| = R|<local>/z|
|
||||
public get(): R|My?|
|
||||
|
||||
}
|
||||
public final fun baseTest(): R|kotlin/Unit| {
|
||||
lvar y: R|My?| = R|/My.My|(R|/My.My|(Null(null)))
|
||||
when () {
|
||||
!=(R|<local>/y|?.{ $subj$.R|/My.x| }, Null(null)) -> {
|
||||
R|<local>/y|.R|/My.x|.R|/My.x|
|
||||
R|<local>/y| = R|/My.My|(Null(null))
|
||||
R|<local>/y|.R|/My.x|.<Inapplicable(UNSAFE_CALL): /My.x>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun deepChainTest(): R|kotlin/Unit| {
|
||||
lvar y: R|My?| = R|/My.My|(R|/My.My|(Null(null)))
|
||||
when () {
|
||||
!=(R|<local>/y|?.{ $subj$.R|/My.x| }?.{ $subj$.R|/My.x| }, Null(null)) -> {
|
||||
R|<local>/y|.R|/My.x|.R|/My.x|.R|/My.x|
|
||||
R|<local>/y| = R|/My.My|(Null(null))
|
||||
R|<local>/y|.R|/My.x|.<Inapplicable(UNSAFE_CALL): /My.x>#.<Inapplicable(UNSAFE_CALL): /My.x>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun backwardAliasTest(z: R|My|): R|kotlin/Unit| {
|
||||
lvar y: R|My| = R|<local>/z|
|
||||
when () {
|
||||
!=(R|<local>/y|.R|/My.x|, Null(null)) -> {
|
||||
R|<local>/y|.R|/My.x|.R|/My.x|
|
||||
R|<local>/y| = R|/My.My|(Null(null))
|
||||
R|<local>/y|.R|/My.x|.<Inapplicable(UNSAFE_CALL): /My.x>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun severalMembersTest(): R|kotlin/Unit| {
|
||||
lvar y: R|My| = R|/My.My|(R|/My.My|(Null(null)), R|/My.My|(Null(null)))
|
||||
when () {
|
||||
!=(R|<local>/y|.R|/My.x|, Null(null)) -> {
|
||||
when () {
|
||||
!=(R|<local>/y|.R|/My.z|, Null(null)) -> {
|
||||
R|<local>/y|.R|/My.x|.R|/My.x|
|
||||
R|<local>/y|.R|/My.z|.R|/My.z|
|
||||
R|<local>/y| = R|/My.My|(Null(null))
|
||||
R|<local>/y|.R|/My.x|.<Inapplicable(UNSAFE_CALL): /My.x>#
|
||||
R|<local>/y|.R|/My.z|.<Inapplicable(UNSAFE_CALL): /My.z>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
class My(val x: My?, val z: My? = null)
|
||||
|
||||
fun baseTest() {
|
||||
var y: My? = My(My(null))
|
||||
if (y?.x != null) {
|
||||
y.x.x
|
||||
y = My(null)
|
||||
y.x<!UNSAFE_CALL!>.<!>x
|
||||
}
|
||||
}
|
||||
|
||||
fun deepChainTest() {
|
||||
var y: My? = My(My(null))
|
||||
if (y?.x?.x != null) {
|
||||
y.x.x.x
|
||||
y = My(null)
|
||||
y.x<!UNSAFE_CALL!>.<!>x<!UNSAFE_CALL!>.<!>x
|
||||
}
|
||||
}
|
||||
|
||||
fun backwardAliasTest(z: My) {
|
||||
var y = z
|
||||
if (y.x != null) {
|
||||
y.x.x
|
||||
y = My(null)
|
||||
y.x<!UNSAFE_CALL!>.<!>x
|
||||
}
|
||||
}
|
||||
|
||||
fun severalMembersTest() {
|
||||
var y = My(My(null), My(null))
|
||||
if (y.x != null) {
|
||||
if (y.z != null) {
|
||||
y.x.x
|
||||
y.z.z
|
||||
y = My(null)
|
||||
y.x<!UNSAFE_CALL!>.<!>x
|
||||
y.z<!UNSAFE_CALL!>.<!>z
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user