FIR checker: warn useless as and is

This commit is contained in:
Jinseong Jeon
2021-04-28 22:32:51 -07:00
committed by TeamCityServer
parent 19d939c36e
commit e2dc21da90
141 changed files with 417 additions and 543 deletions
+3 -3
View File
@@ -20,9 +20,9 @@ fun foo() : Int {
val x = 1
when (x) {
is String -> 1
!is Int -> 1
is Any? -> 1
is Any -> 1
<!USELESS_IS_CHECK!>!is Int<!> -> 1
<!USELESS_IS_CHECK!>is Any?<!> -> 1
<!USELESS_IS_CHECK!>is Any<!> -> 1
s -> 1
1 -> 1
1 <!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!> <!UNRESOLVED_REFERENCE!>a<!> -> 1
@@ -23,7 +23,7 @@ fun foo(s: Any): String {
fun bar(s: Any): String {
val x = when (s) {
is String -> s as String // meaningless
is String -> s <!USELESS_CAST!>as String<!> // meaningless
is Int -> "$s"
else -> return ""
}