Skip to content

Fix aggregation of imports.#67

Merged
peterhuene merged 3 commits intomainfrom
fix-aggregation
Apr 7, 2024
Merged

Fix aggregation of imports.#67
peterhuene merged 3 commits intomainfrom
fix-aggregation

Conversation

@peterhuene
Copy link
Copy Markdown
Member

This PR fixes aggregation of imports that have used types.

Previously, interfaces weren't being coalesced properly, resulting in duplicate imports of used interfaces that would result in an encoding validation error.

The fix is to coalesce interfaces by interface identifier, merging interfaces together during the remapping process.

Additionally, this fixes a bug in encoding where any implicitly imported instances were not getting their encoded indexes recorded in the encoding state properly.

Also changed the map in the type aggregator to store Types rather than ItemKinds, which makes things neater.

Fixes #65.

This commit fixes aggregation of imports that have used types.

Previously, interfaces weren't being coalesced properly, resulting in duplicate
imports of used interfaces that would result in an encoding validation error.

The fix is to coalesce interfaces by interface identifier, merging interfaces
together during the remapping process.

Additionally, this fixes a bug in encoding where any implicitly imported
instances were not getting their encoded indexes recorded in the encoding state
properly.

Also changed the map in the type aggregator to store `Type`s rather than
`ItemKind`s, which makes things neater.

Fixes #65.
@peterhuene peterhuene requested a review from rylev April 5, 2024 20:27
Copy link
Copy Markdown
Collaborator

@rylev rylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few tiny nits. Looks great!

Comment thread crates/wac-types/src/aggregator.rs
Comment thread crates/wac-types/src/aggregator.rs Outdated
Comment thread crates/wac-types/src/aggregator.rs Outdated
Comment thread crates/wac-types/src/aggregator.rs Outdated
@peterhuene peterhuene merged commit f398c13 into main Apr 7, 2024
@peterhuene peterhuene deleted the fix-aggregation branch April 7, 2024 18: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.

[Graph] error encoding a component: "import name conflicts with previous name"

2 participants