Skip to content

NotImplementedError in ExposedDescriptorsCache.exposeGlobalMemberOrExtension when using Metro's generateContributionProviders #183

Description

@spectrl

Description

When using Metro (v0.13.2) with generateContributionProviders enabled, SKIE 0.10.11 crashes during iOS framework linking with a NotImplementedError in ExposedDescriptorsCache.exposeGlobalMemberOrExtension.

generateContributionProviders is a Metro feature that generates synthetic FIR provider declarations (top-level functions/properties) in submodules, allowing @ContributesBinding implementation classes to remain internal instead of public. SKIE appears unable to categorize these Metro-generated synthetic declarations during the linkDebugFrameworkIosSimulatorArm64 phase.

Environment

  • Kotlin: 2.3.20
  • SKIE: 0.10.11
  • Metro: 0.13.2
  • Xcode: 26.0.1
  • Target: iosSimulatorArm64

Reproduction

  1. In a Kotlin Multiplatform project using Metro for DI, add generateContributionProviders.set(true) to any submodule's build.gradle.kts:
metro {
    generateContributionProviders.set(true)
}
  1. Have at least one @ContributesBinding class in that submodule:
@ContributesBinding(AppScope::class)
internal class DefaultRepository(
    private val api: Api,
) : Repository { ... }
  1. Run the iOS framework link task:
./gradlew linkDebugFrameworkIosSimulatorArm64

Error

e: Compilation failed: An operation is not implemented.
 
e: kotlin.NotImplementedError: An operation is not implemented.
    at co.touchlab.skie.kir.descriptor.cache.ExposedDescriptorsCache.exposeGlobalMemberOrExtension(ExposedDescriptorsCache.kt:130)
    at co.touchlab.skie.kir.descriptor.cache.ExposedDescriptorsCache.exposePackageFragment(ExposedDescriptorsCache.kt:89)
    at co.touchlab.skie.kir.descriptor.cache.ExposedDescriptorsCache.exposeModules(ExposedDescriptorsCache.kt:75)
    at co.touchlab.skie.kir.descriptor.cache.ExposedDescriptorsCache.<init>(ExposedDescriptorsCache.kt:43)
    ...
 
> Task :shared:linkDebugFrameworkIosSimulatorArm64 FAILED

Workaround

Disabling generateContributionProviders and making impl classes public instead of internal avoids the crash, but loses the encapsulation benefit the feature provides.

Notes

  • This is related to Support kotlin-2.3.20 #174 — SebRut reported a similar class of error (different stack trace) when testing SKIE with Metro during the Kotlin 2.3.20 beta period. The NoSuchMethodError from that report appears to have been fixed in 0.10.11, but this NotImplementedError persists.
  • The crash occurs regardless of whether generateContributionProviders is enabled globally or per-submodule.
  • Without generateContributionProviders, Metro + SKIE works correctly with @ContributesBinding classes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions