Inspectopedia
 
2024.3

Progression resolution change since 1.9

Warning
New
Last modified: 03 December 2024

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.

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

After the quick-fix is applied:

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