After switching to 1.0.0-rc-1017, we now get quite a few of these warnings, none of which seems to be helpful/warranted.
Here is an illustration:
interface Foo {
// methods are called for their side effects,
// return "this" to allow builder-style chaining (third-party API)
fun foo(): Foo
fun bar(): Foo
fun baz(): Foo
}
fun main(foo: Foo, condition: Boolean) {
with(foo) {
if (condition) {
foo()
bar()
baz() // result type Foo, intentionally neglected
} else {
doSomethingWithFoo(this) // result type Unit, intentional
}
}
}
private fun doSomethingWithFoo(foo: Foo) {}
Same when using other side-effecting methods that return values, e.g. File.delete()
.
I understand what the warning is trying to achieve, but isn’t this too aggressive in the face of such “statement” use?