Data flow info: correct disjunction of a type with Nothing: Type U Nothing = Type #KT-9578 Fixed
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
fun foo(s: Any): String {
|
||||
val x = when (s) {
|
||||
is String -> s
|
||||
is Int -> "$s"
|
||||
else -> return ""
|
||||
}
|
||||
|
||||
val y: String = <!DEBUG_INFO_SMARTCAST!>x<!> // should be Ok
|
||||
return y
|
||||
}
|
||||
|
||||
fun bar(s: Any): String {
|
||||
val x = when (s) {
|
||||
is String -> s <!USELESS_CAST!>as String<!> // meaningless
|
||||
is Int -> "$s"
|
||||
else -> return ""
|
||||
}
|
||||
|
||||
val y: String = x // no error
|
||||
return y
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ s: kotlin.Any): kotlin.String
|
||||
public fun foo(/*0*/ s: kotlin.Any): kotlin.String
|
||||
Reference in New Issue
Block a user