Do not report redundant else for enum / sealed from another module

Related to KT-17497
This commit is contained in:
Mikhail Glukhikh
2017-05-02 16:45:59 +03:00
parent 35754a98e7
commit 1273166ed0
4 changed files with 112 additions and 1 deletions
@@ -0,0 +1,45 @@
// MODULE: m1
// FILE: a.kt
package test
enum class E {
FIRST
}
sealed class S
class Derived : S()
// MODULE: m2(m1)
// FILE: b.kt
package other
import test.*
fun foo(e: E) = when (e) {
E.FIRST -> 42
else -> -42
}
fun bar(s: S?) = when (s) {
is Derived -> "Derived"
null -> ""
else -> TODO("What?!?!")
}
fun baz(b: Boolean?) = when (b) {
true -> 1
false -> 0
null -> -1
// Still warning
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> TODO()
}
fun baz(b: Boolean) = when (b) {
true -> 1
false -> 0
// Still warning
<!REDUNDANT_ELSE_IN_WHEN!>else<!> -> TODO()
}