Back to Intellij Community

AddConversionCallMigration

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

2025.3-rc-2446 B
Original Source

Reports expressions that will be of type Int, thus causing compilation errors in Kotlin 1.9 and later.

Example:

fun takeByte(x: Byte) {}

  fun foo() {
      takeByte(1 + 1) // will be resolved to Int in 1.9
  }

After the quick-fix is applied:

fun takeByte(x: Byte) {}

  fun foo() {
      takeByte((1 + 1).toByte()) // will be resolved to Int in 1.9
  }

Inspection is available for Kotlin language level starting from 1.7.