Inspectopedia Help

Multiple operators with different precedence

Reports binary expressions that consist of different operators without parentheses.

Such expressions can be less readable due to different precedence rules of operators.

Example:

fun foo(b: Boolean?, i: Int?) { val x = b ?: i == null // evaluated as `(b ?: i) == null` val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)` }

Inspection options

Option

Type

Default

Report even obvious cases

Checkbox

false

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023