Extension Shadowing for Actual Declarations in KMP

Heads-up: this article assumes familiarity with Kotlin’s extension functions and expect and actual declarations in Kotlin Multiplatform (KMP). My work has recently focused on “commonizing”1 APIs, and I came across KT-70012, which I believe merits attention. In Kotlin JVM development, the EXTENSION_SHADOWED_BY_MEMBER warning indicates that an extension function is redundant, as it will always be overshadowed by a member function with the same name when invoked. However, in KMP, this behaviour can be useful, as shadowing may occur on some platforms but not all....

November 7, 2024