Alias use'd types during composition instead of re-encoding them locally#205
Merged
fibonacci1729 merged 2 commits intoJun 16, 2026
Merged
Conversation
use'd types during composition instead of re-encoding them locally
512fb63 to
b5d5381
Compare
0991467 to
8c14cd5
Compare
A type used from another interface, referenced only by id, was re-encoded as a fresh local definition instead of the alias `use_aliases` emitted, failing validation. Record the alias under the type's ids so id-keyed lookups reuse it.
Top-level aggregated imports carry no `uses` map, so a type referenced by id (e.g. an imported instance's export used in a record field) was re-encoded as an invalid local definition. `value_type` now aliases it from the imported instance, and imports are encoded instances-first.
8c14cd5 to
1f06572
Compare
fibonacci1729
approved these changes
Jun 16, 2026
fibonacci1729
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for this! This looks good to me 👍
Contributor
Author
|
Thank you so much @fibonacci1729 - is it possible to get a patch release for this change? |
Collaborator
|
You got it -- i'll work on getting that out today. |
Collaborator
Contributor
Author
|
Thank you! @fibonacci1729 |
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.
Composing components fails validation with
type not valid to be used as importwhenever ause'd type is involved: the encoder re-encodes a type reachable only by id as a fresh local definition rather than referencing the imported instance's export it denotes. A world-level type import whose definition points at a local definition is not a valid import.Two commits, one per encode path:
use_aliases(type-bound path): records each emitted alias under the used type's ids so id-keyed lookups reuse it. Test:nested-use-type.value_type(aggregated-import path): the composed component's top-level imports carry nousesmap, so this path needs the alias derived from the instances already imported into the scope; imports are encoded instances-first so the instance registers before referrers. Test:use-type-by-id-import.wac plugon the equivalent two components fails identically before this change.implicit-resource-importis re-blessed (instances-first ordering drops one redundant alias; encoding is equivalent).ps: The two alias paths could be unified once the aggregator preserves
usesthrough aggregation.