FIR checker: support DUPLICATE_LABEL_IN_WHEN
Changes from FE1.0: 1. As discussed previously, no expression evaluation happens during this check. 2. FE1.0 doesn't check redundant object comparisons.
This commit is contained in:
committed by
Mikhail Glukhikh
parent
7c6326856b
commit
4915d8dda3
@@ -41,6 +41,7 @@ fun third(arg: Any?): Int {
|
||||
is Double -> return 1
|
||||
is <!DUPLICATE_LABEL_IN_WHEN!>Double<!> -> return 2
|
||||
<!DUPLICATE_LABEL_IN_WHEN!>null<!> -> return 3
|
||||
!is String -> return 4
|
||||
else -> return 5
|
||||
}
|
||||
}
|
||||
@@ -59,3 +60,11 @@ fun fifth(arg: Any?) = when (arg) {
|
||||
<!ELSE_MISPLACED_IN_WHEN!>else<!> -> ""
|
||||
<!UNREACHABLE_CODE!>else -> null<!>
|
||||
}
|
||||
|
||||
object Foo
|
||||
|
||||
fun sixth(arg: Any?) = when (arg) {
|
||||
Foo -> ""
|
||||
Foo -> ""
|
||||
else -> null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user