Repository navigation
Conversation
Component and instance types can declare core recursion groups, which `wasmprinter` prints as `(core rec ...)` like at the top level of a component, but the text parser only accepted them at the top level, so the printed text of these valid components didn't parse.
alexcrichton
requested review from
alexcrichton
and removed request for
dicej
October 24, 2026 03:06
| fn expand_component_ty(&mut self, ty: &mut ComponentType<'a>) { | ||
| Expander::default().expand_decls(&mut ty.decls, |e, decl| match decl { | ||
| ComponentTypeDecl::CoreType(t) => e.expand_core_type(t), | ||
| ComponentTypeDecl::CoreRec(_) => {} |
Member
There was a problem hiding this comment.
I think this, and the one below, need to call expand_core_type on the rec group members, right?
Contributor
Author
There was a problem hiding this comment.
I don't think these need it. Rec group members are core::Types rather than CoreTypes, so they can't be module types. For non-module types, expand_core_type only fills in a generated id that nothing uses. The top-level ComponentField::CoreRec(_) => None skips them the same way. I've added a test where a module type uses alias outer to refer to a rec group member next to an inline func type, and it roundtrips. I can add the call anyway if you'd prefer.
Covers a module type in an instance type that refers to a type in a rec group through an outer alias, next to an inline function type.
This branch has not been deployed
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.
Component and instance types can declare core recursion groups, which
wasmprinterprints as(core rec ...), like at the top level of a component. The text parser only accepted them at the top level, so this valid component printed as text that didn't parse:This parses, resolves and encodes them in component and instance types as at the top level.
Found by fuzzing with components generated from the component model's binary grammar (#2796, which skips these until this lands).