Back to Intellij Community

ReplaceToWithInfixForm

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

2025.3-rc-2340 B
Original Source

Reports to function calls that can be replaced with the infix form.

Using the infix form makes your code simpler.

The quick-fix replaces to with the infix form.

Example:

fun foo(a: Int, b: Int) {
      val pair = a.to(b)
  }

After the quick-fix is applied:

fun foo(a: Int, b: Int) {
      val pair = a to b
  }