Discover list instantiations from bare literals in wasm-gc codegen - #766
Merged
Conversation
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.
The wasm-gc backend rejected any program whose only
List<T>instantiation appears as a bare list literal —Console.print("{[1, 2, 3]}")in aUnitfn failed withList literal: cannot resolve list instantiation (got `List<Int>`). Surfaced by @n1bor while testing #764.Two independent gaps in type discovery:
letannotations, and record fields, so the emitter's canonical resolution succeeded but the registry lookup missed;"{...}"was visible to discovery at all.The body walk now carries
Spannednodes so the checker's type stamps are readable; list literals register their stamped type, behind a structural concreteness guard, with a first-element fallback mirroring the emitter's hint chain. All three collectors (lists, options, vectors) got the missing traversal arms, and the expression matches are now exhaustive, so a future HIR variant fails the build instead of silently skipping discovery.Three regressions in
wasm_gc_codegen_regression: interpolated bare literal, unannotated binding, nested literal — each compiled and validated withwasmparser.wasm_gc_codegen_regression5/5,wasm_gc_spec37/37,cargo fmt --checkclean, clippy clean with wasm features.