FIR DFA: smartcast variable to Nothing? on null assignment
In order to make resolution still work for members not available from `Nothing`, we track the type without `Nothing?` and use that for resolution instead.
This commit is contained in:
committed by
teamcityserver
parent
7e2f15f532
commit
4726dcce40
@@ -7,7 +7,7 @@ fun foo(): String {
|
||||
var t: String? = "y"
|
||||
if (t == null) t = "x"
|
||||
var x: Int? = null
|
||||
if (x == null) x <!UNSAFE_OPERATOR_CALL!>+=<!> null
|
||||
if (x == null) <!ASSIGNMENT_TYPE_MISMATCH!>x += null<!>
|
||||
return t + s
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ fun String?.gav() {}
|
||||
fun bar(s: String?) {
|
||||
if (s != null) return
|
||||
s.gav()
|
||||
s <!USELESS_CAST!>as? String<!>
|
||||
s <!USELESS_CAST!>as String?<!>
|
||||
s as? String
|
||||
s as String?
|
||||
s as String
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user