Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain more internal consistency checks when merging worlds #1792

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

alexcrichton
Copy link
Member

This commit fixes two issues, both preexisting, which represented
violated invariants of a Resolve after worlds were merged. World
merging is used during component generation and might be used for
bindings generation so it's important to maintain the various dynamic
invariants of Resolve to ensure that surrounding tooling works. An
example of this is that printing a merged world doesn't produce
parseable WIT today because some of the internal invariants aren't
respected.

This commit beefs up the Resolve::assert_valid function and then
applies necessary fixes to resolve these assertion failures on
preexisting test cases. The main difference is that anonymous
interfaces/types are now "cloned" when they move from one world to
another. This is required to ensure that all the various links between
these items are consistent and point to the right place. This cloning
infrastructure may end up being more generalized in the future if the
need arises, but for now it's quite limited.

@alexcrichton
Copy link
Member Author

I'll note that this is stacked on #1791 so the first commit can be ignored.

This commit fixes two issues, both preexisting, which represented
violated invariants of a `Resolve` after worlds were merged. World
merging is used during component generation and might be used for
bindings generation so it's important to maintain the various dynamic
invariants of `Resolve` to ensure that surrounding tooling works. An
example of this is that printing a merged world doesn't produce
parseable WIT today because some of the internal invariants aren't
respected.

This commit beefs up the `Resolve::assert_valid` function and then
applies necessary fixes to resolve these assertion failures on
preexisting test cases. The main difference is that anonymous
interfaces/types are now "cloned" when they move from one world to
another. This is required to ensure that all the various links between
these items are consistent and point to the right place. This cloning
infrastructure may end up being more generalized in the future if the
need arises, but for now it's quite limited.
@alexcrichton alexcrichton added this pull request to the merge queue Sep 17, 2024
Merged via the queue into bytecodealliance:main with commit 3226b14 Sep 17, 2024
30 checks passed
@alexcrichton alexcrichton deleted the clone-on-merge branch September 17, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants