More correct handling of possible type set during assignment #KT-8229 Fixed
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
fun foo(x: String) = x
|
||||
|
||||
fun test1() {
|
||||
var c: Any? = "XXX"
|
||||
if (c !is String) return
|
||||
|
||||
val newC: String? = "YYY"
|
||||
if (newC != null) {
|
||||
c = newC
|
||||
}
|
||||
foo(<!DEBUG_INFO_SMARTCAST!>c<!>)
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
var c: Any? = "XXX"
|
||||
if (c !is String) return
|
||||
|
||||
val newC: String? = "YYY"
|
||||
if (newC is String) {
|
||||
c = newC
|
||||
}
|
||||
foo(<!DEBUG_INFO_SMARTCAST!>c<!>)
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
var c: Any? = "XXX"
|
||||
if (c !is String) return
|
||||
|
||||
val newC: String? = "YYY"
|
||||
if (newC == null) return
|
||||
c = newC
|
||||
|
||||
foo(<!DEBUG_INFO_SMARTCAST!>c<!>)
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ x: kotlin.String): kotlin.String
|
||||
public fun test1(): kotlin.Unit
|
||||
public fun test2(): kotlin.Unit
|
||||
public fun test3(): kotlin.Unit
|
||||
Reference in New Issue
Block a user