Back to Intellij Community

UnclearPrecedenceOfBinaryExpression

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/UnclearPrecedenceOfBinaryExpression.html

2025.3-rc-2411 B
Original Source

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