Fix text format outer aliases from recent refactor - #2631
Merged
alexcrichton merged 1 commit intoAug 31, 2026
Conversation
This commit fixes a regression from bytecodealliance#2621 where the resolution of `$foo` names in the text format of components was refactored. Specifically after that refactoring this component no longer produced a valid binary: (component $A (type $a string) (component $B (type (instance (export "a" (type (eq $a))))) (type $b (record (field "x" $a))) ) ) The reason for this is that `$a` is used twice as implicitly-injected outer aliases here, but the higher-depth one comes first. The previous behavior would leave the `$a` name on the injected outer alias type, which then caused the resolution of `(eq $a)` to resolve to the `$a` within the definition of `$B` (despite it being later and invalid to reference), instead of the definition within `$A` which was the target. The fix here is to leave off the name in the injected outer alias. This preserves the behavior pre-bytecodealliance#2621 which was accidentally removed, and causes the above component to generate a valid binary instead of an invalid binary. This has various bits and pieces of impact throughout tests which now resolve slightly differently than before, or are missing a `$foo` name, as expected.
pchickey
approved these changes
Aug 31, 2026
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 commit fixes a regression from #2621 where the resolution of
$foonames in the text format of components was refactored. Specifically after that refactoring this component no longer produced a valid binary:The reason for this is that
$ais used twice as implicitly-injected outer aliases here, but the higher-depth one comes first. The previous behavior would leave the$aname on the injected outer alias type, which then caused the resolution of(eq $a)to resolve to the$awithin the definition of$B(despite it being later and invalid to reference), instead of the definition within$Awhich was the target.The fix here is to leave off the name in the injected outer alias. This preserves the behavior pre-#2621 which was accidentally removed, and causes the above component to generate a valid binary instead of an invalid binary.
This has various bits and pieces of impact throughout tests which now resolve slightly differently than before, or are missing a
$fooname, as expected.