Back to Intellij Community

ReplaceCallWithBinaryOperator

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

2025.3-rc-2302 B
Original Source

Reports function calls that can be replaced with binary operators, in particular comparison-related ones.

Example:

fun test(): Boolean {
      return 2.compareTo(1) > 0 // replaceable 'compareTo()'
  }

After the quick-fix is applied:

fun test(): Boolean {
      return 2 > 1
  }