13eddba1f2
Note that there are some other problems, for example: `val a = if (true) 1 as Number else 2`, here we'll get useless cast #KT-9551 Fixed #KT-9645 Fixed
17 lines
398 B
Kotlin
Vendored
17 lines
398 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
|
|
|
fun test() {
|
|
val a = 1 as Any?
|
|
val b: Number = 1 <!USELESS_CAST!>as Number<!>
|
|
val c = null as String?
|
|
val d: Number = 1 <!USELESS_CAST!>as Int<!>
|
|
}
|
|
|
|
val c1 get() = 1 as Number
|
|
val c2: Number get() = 1 <!USELESS_CAST!>as Number<!>
|
|
|
|
val d: Number
|
|
get() {
|
|
1 <!USELESS_CAST!>as Number<!>
|
|
return 1 <!USELESS_CAST!>as Number<!>
|
|
} |