[FIR] Don't save DFA implications for unstable local vars
^KT-57502 Fixed
This commit is contained in:
committed by
Space Team
parent
31424e38ac
commit
40b8b682f9
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
FILE: smartcastStoredInLocalVar.kt
|
||||
public final fun nonInPlaceRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test_0(a: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
lvar b: R|kotlin/Boolean| = (R|<local>/a| is R|kotlin/String|)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
R|/nonInPlaceRun|(<L> = nonInPlaceRun@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_1(a: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
lvar b: R|kotlin/Boolean| = (R|<local>/a| is R|kotlin/String|)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
R|/nonInPlaceRun|(<L> = nonInPlaceRun@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
R|<local>/b| = Boolean(true)
|
||||
}
|
||||
public final fun test_2(a: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
lvar b: R|kotlin/Boolean| = (R|<local>/a| is R|kotlin/String|)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
R|/nonInPlaceRun|(<L> = nonInPlaceRun@fun <anonymous>(): R|kotlin/Unit| <inline=NoInline> {
|
||||
R|<local>/b| = Boolean(true)
|
||||
}
|
||||
)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_3(a: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
lvar b: R|kotlin/Boolean| = (R|<local>/a| is R|kotlin/String|)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
R|kotlin/run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
R|<local>/b| = Boolean(true)
|
||||
}
|
||||
public final fun test_4(a: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
lvar b: R|kotlin/Boolean| = (R|<local>/a| is R|kotlin/String|)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
R|kotlin/run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
R|<local>/b| = Boolean(true)
|
||||
}
|
||||
)
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_5(a: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
lvar b: R|kotlin/Boolean| = (R|<local>/a| is R|kotlin/String|)
|
||||
while(R|<local>/b|) {
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/b| = (R|<local>/a| is R|kotlin/String|)
|
||||
}
|
||||
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|<local>/a|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+84
@@ -0,0 +1,84 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-58604
|
||||
|
||||
fun nonInPlaceRun(block: () -> Unit) {}
|
||||
|
||||
fun test_0(a: Any) {
|
||||
var b = a is String
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // can be ok
|
||||
}
|
||||
nonInPlaceRun {
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // can be ok
|
||||
}
|
||||
}
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // can be ok
|
||||
}
|
||||
}
|
||||
|
||||
fun test_1(a: Any) {
|
||||
var b = a is String
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // can be ok
|
||||
}
|
||||
nonInPlaceRun {
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // not ok
|
||||
}
|
||||
}
|
||||
b = true
|
||||
}
|
||||
|
||||
fun test_2(a: Any) {
|
||||
var b = a is String
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // can be ok
|
||||
}
|
||||
nonInPlaceRun {
|
||||
b = true
|
||||
}
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // not ok
|
||||
}
|
||||
}
|
||||
|
||||
fun test_3(a: Any) {
|
||||
var b = a is String
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // // can be ok
|
||||
}
|
||||
run {
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // // can be ok
|
||||
}
|
||||
}
|
||||
b = true
|
||||
}
|
||||
|
||||
fun test_4(a: Any) {
|
||||
var b = a is String
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // // can be ok
|
||||
}
|
||||
run {
|
||||
b = true
|
||||
}
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // not ok
|
||||
}
|
||||
}
|
||||
|
||||
fun test_5(a: Any) {
|
||||
var b = a is String
|
||||
while (b) {
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // not ok
|
||||
}
|
||||
b = a is String
|
||||
}
|
||||
if (b) {
|
||||
a.<!UNRESOLVED_REFERENCE!>length<!> // // can be ok
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user