Inspectopedia 2024.3 Help

Progression resolution change since 1.9

Reports overloaded function calls where an argument requires an explicit cast to resolve to a proper declaration. The current compiler warning (available since Kotlin 1.6.20) will become an error in Kotlin 1.8.

Progressions and ranges types (kotlin.ranges) will start implementing the Collection interface in Kotlin 1.9 and later. This update will cause a change in resolution for overloaded functions. For instance, in the example below, the test(1..5) call will be resolved to test(t: Any) in Kotlin 1.8 and earlier and to test(t: Collection<*>) in Kotlin 1.9 and later.

fun test(t: Any) { } fun test(t: Collection<*>) { } fun invoke() { test(1..5) // IntRange becomes Collection in 1.9 }

The provided quick-fix captures the behaviour specific to the compiler of version 1.8 and earlier:

fun test(t: Any) { } fun test(t: Collection<*>) { } fun invoke() { test(1..5) // resolved to 'test(t: T)' before Kotlin 1.9 }

After the quick-fix is applied:

fun test(t: Any) { } fun test(t: Collection<*>) { } fun invoke() { test((1..5) as Iterable<Int>) // resolved to 'test(t: T)' in Kotlin 1.9 }

Inspection is available for the Kotlin language level starting from 1.6.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

CastDueToProgressionResolutionChangeMigration
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Kotlin | Migration

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.3, Qodana for JVM 2024.3,

Can be installed with plugin:

Kotlin, 243.23126-IJ

Last modified: 03 December 2024