FIR checker: warn useless as and is
This commit is contained in:
committed by
TeamCityServer
parent
19d939c36e
commit
e2dc21da90
@@ -1,23 +0,0 @@
|
||||
sealed class Stmt
|
||||
|
||||
class ForStmt : Stmt()
|
||||
|
||||
sealed class Expr : Stmt() {
|
||||
object BinExpr : Expr()
|
||||
}
|
||||
|
||||
fun test(x: Stmt): String =
|
||||
when (x) {
|
||||
is Expr -> "expr"
|
||||
is Stmt -> "stmt"
|
||||
}
|
||||
|
||||
fun test2(x: Stmt): String =
|
||||
<!NO_ELSE_IN_WHEN!>when<!> (x) {
|
||||
is Expr -> "expr"
|
||||
}
|
||||
|
||||
fun test3(x: Expr): String =
|
||||
when (x) {
|
||||
is Stmt -> "stmt"
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
sealed class Stmt
|
||||
|
||||
class ForStmt : Stmt()
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
sealed class Sealed {
|
||||
object First: Sealed()
|
||||
open class NonFirst: Sealed() {
|
||||
object Second: NonFirst()
|
||||
object Third: NonFirst()
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(s: Sealed): Int {
|
||||
return <!NO_ELSE_IN_WHEN!>when<!>(s) {
|
||||
is Sealed.First -> 1
|
||||
!is Any -> 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
sealed class Sealed {
|
||||
object First: Sealed()
|
||||
open class NonFirst: Sealed() {
|
||||
|
||||
Reference in New Issue
Block a user