Clear DF info for variables assigned in 'try' #KT-17929 Fixed

This commit is contained in:
Mikhail Glukhikh
2017-05-19 15:57:36 +03:00
committed by Mikhail Glukhikh
parent 0fd70df681
commit adbece82ef
10 changed files with 54 additions and 9 deletions
@@ -1,3 +1,5 @@
// !LANGUAGE: +SoundSmartCastsAfterTry
fun bar(arg: Any?) = arg
fun foo() {
@@ -6,7 +8,7 @@ fun foo() {
try {
s = "Test"
} catch (ex: Exception) {}
bar(<!DEBUG_INFO_CONSTANT!>s<!>)
if (<!SENSELESS_COMPARISON!><!DEBUG_INFO_CONSTANT!>s<!> != null<!>) { }
<!DEBUG_INFO_CONSTANT!>s<!><!UNSAFE_CALL!>.<!>hashCode()
bar(s)
if (s != null) { }
s<!UNSAFE_CALL!>.<!>hashCode()
}
@@ -1,8 +1,10 @@
// !LANGUAGE: +SoundSmartCastsAfterTry
fun foo() {
var s: String?
s = "Test"
try {
s = null
} catch (ex: Exception) {}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
s<!UNSAFE_CALL!>.<!>hashCode()
}
@@ -1,3 +1,5 @@
// !LANGUAGE: +SoundSmartCastsAfterTry
fun bar() {}
fun foo() {
@@ -10,5 +12,5 @@ fun foo() {
finally {
bar()
}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
s<!UNSAFE_CALL!>.<!>hashCode()
}
@@ -0,0 +1,8 @@
fun foo() {
var s: String?
s = "Test"
try {
s = null
} catch (ex: Exception) {}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
}
@@ -0,0 +1,3 @@
package
public fun foo(): kotlin.Unit
@@ -1,8 +1,11 @@
// !LANGUAGE: +SoundSmartCastsAfterTry
fun foo() {
var s: String?
s = "Test"
try {
s = "Other"
} catch (ex: Exception) {}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
// Problem: here we do not see that 's' is always not-null
s<!UNSAFE_CALL!>.<!>hashCode()
}