Non-idiomatic 'is' type check for an object
Reports non-idiomatic is
type checks for an object.
It's recommended to replace such checks with reference comparison.
Example:
object Foo
fun foo(arg: Any) = when {
arg is Foo -> ...
arg !is Foo -> ...
}
After the quick-fix is applied:
object Foo
fun foo(arg: Any) = when {
arg === Foo -> ...
arg !== Foo -> ...
}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Kotlin, @snapshot@ |
Last modified: 13 July 2023