fix WIT type alias in js-component-bindgen (see issue #1534)#1549
Merged
vados-cosmonic merged 2 commits intoMay 26, 2026
Conversation
vados-cosmonic
previously approved these changes
May 26, 2026
Collaborator
vados-cosmonic
left a comment
There was a problem hiding this comment.
LGTM 🚀
Thanks @jasoncg for this fix -- for handling Type::Id(..)s I think we can recur there rather than panicking so early -- so I'll probably add that change on before merging, but even as-is I think the code is certainly an improvement.
This commit adds support for WIT type aliases via the call to `gen_dataview_set_and_check_fn_js_for_numeric_type()` see: issue bytecodealliance#1534
bb65e9f to
26df952
Compare
vados-cosmonic
previously approved these changes
May 26, 2026
Collaborator
|
Resolves #1534 |
26df952 to
f9d6442
Compare
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.
This is a fix for issue #1534 where type aliases in some cases can cause a runtime panic.
I also included a test case that passes with the fix applied.
The primary change to
gen_dataview_set_and_check_fn_js_for_numeric_type()is that it now takes a wit_parser::resolve::Resolve so Type::Id(id) can be looked up.I'm not sure if it's actually possible to end up in this state, but one potential risk since
gen_dataview_set_and_check_fn_js_for_numeric_type()is now called recursively is if a Type::Id is poorly defined such that it references itself it could cause an infinite loop.