FIR CFA: add edges from maybe-throwing statements to catch/finally
This commit is contained in:
Vendored
+3
-3
@@ -13,7 +13,7 @@ fun f1(flag: Boolean) {
|
||||
}
|
||||
catch (e: Exception) {
|
||||
// KT-13612: reassignment
|
||||
n = 3
|
||||
<!VAL_REASSIGNMENT!>n<!> = 3
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>n<!>.hashCode()
|
||||
}
|
||||
@@ -30,7 +30,7 @@ fun f2(flag: Boolean) {
|
||||
}
|
||||
catch (e: Exception) {
|
||||
// KT-13612: reassignment
|
||||
n = 3
|
||||
<!VAL_REASSIGNMENT!>n<!> = 3
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>n<!>.hashCode()
|
||||
}
|
||||
@@ -48,7 +48,7 @@ fun f3(flag: Boolean) {
|
||||
}
|
||||
catch (e: Exception) {
|
||||
// KT-13612: reassignment
|
||||
n = 3
|
||||
<!VAL_REASSIGNMENT!>n<!> = 3
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>n<!>.hashCode()
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// !SKIP_TXT
|
||||
|
||||
fun exc(flag: Boolean) {
|
||||
if (flag) throw RuntimeException()
|
||||
}
|
||||
|
||||
fun test(flag: Boolean) {
|
||||
var x: Any?
|
||||
x = ""
|
||||
try {
|
||||
x = null
|
||||
exc(flag)
|
||||
x = 1
|
||||
exc(!flag)
|
||||
x = ""
|
||||
} catch (e: Throwable) {
|
||||
// all bad - could come here from either call
|
||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
x.<!UNRESOLVED_REFERENCE!>inc<!>()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// !SKIP_TXT
|
||||
|
||||
fun exc(flag: Boolean) {
|
||||
if (flag) throw RuntimeException()
|
||||
}
|
||||
|
||||
fun test(flag: Boolean) {
|
||||
var x: Any?
|
||||
x = ""
|
||||
try {
|
||||
<!UNUSED_VALUE!>x =<!> null
|
||||
exc(flag)
|
||||
<!UNUSED_VALUE!>x =<!> 1
|
||||
exc(!flag)
|
||||
x = ""
|
||||
} catch (e: Throwable) {
|
||||
// all bad - could come here from either call
|
||||
<!DEBUG_INFO_SMARTCAST!>x<!>.length
|
||||
x.<!UNRESOLVED_REFERENCE!>inc<!>()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user