Fix duplicate injectedparams_* IR signatures on KLIB targets (iOS/wasmJs)#55
Merged
Merged
Conversation
…ed by multiple modules A target type collected by more than one @componentscan module (getAllKnownDefinitions flat-maps definitions across modules) emitted the injectedparams_<fqName> hint function once per definition. Identical signatures are tolerated on JVM but a hard KLIB serialization failure on Native/JS/Wasm (compiler#40, #44). Emit the hint exactly once per target FqName (gate on localSlots.putIfAbsent). Since only non-ambiguous targets reach this point, they share an identical shape, so a single hint is correct. Adds box regression test injected_param_dual_definition_single_hint (two @componentscan modules over the same @InjectedParam target): asserts a single injectedparams_ function (was 2 pre-fix). Full box suite green. Refs #40, #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On non-JVM targets (iOS native, wasmJs/JS), the plugin failed KLIB serialization with:
(compiler#44 iOS, the first wall of compiler#40 wasmJs). JVM tolerates duplicate IR signatures; KLIB serialization does not.
Root cause
getAllKnownDefinitions()flat-maps definitions across modules, so a target type collected by more than one@ComponentScanmodule appears multiple times.InjectedParamHintGeneratoremitted theinjectedparams_<fqName>hint once per definition — duplicate IR functions with identical signatures.Fix
Emit the hint exactly once per target (gate on
localSlots.putIfAbsent(...) == null). Targets reaching this point are non-ambiguous (identical shape), so a single hint is correct.Verification
injected_param_dual_definition_single_hint(two@ComponentScanmodules over the same target): asserts a singleinjectedparams_function (was 2 pre-fix).BUILD SUCCESSFULpost-fix (realiosArm64compile).Fixes #44 · refs #40
🤖 Generated with Claude Code