Inspectopedia
 
2024.3

Multiple operators with different precedence

Warning
Last modified: 03 December 2024

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)` }