Expected Behavior
A use of an annotated method with @CheckReturnValue at the end of an if expression should be flagged by IgnoredReturnValue if the output of the if is not used.
Same for the when.
Steps to Reproduce
package test
import kotlin.random.Random
@CheckReturnValue
fun returnsInt() = 42
if (Random.nextBoolean()) {
println("hello")
} else {
returnsInt()
}
Your Environment
- Version of detekt used: master (1.14.2)
Expected Behavior
A use of an annotated method with
@CheckReturnValueat the end of an if expression should be flagged byIgnoredReturnValueif the output of the if is not used.Same for the
when.Steps to Reproduce
Your Environment