Skip to content

Conversation

@rylev
Copy link
Contributor

@rylev rylev commented Apr 13, 2023

Fixes #977

Instance exports were not being reflected in the TypeMap meaning that future declarations would refer to the direct type definition instead of the export definition. This updates that handling so that the type map is updated with the index of the export.

Big thanks to @peterhuene for the helpful hints!

Note: I also updated some error handling to give better errors to help with a new error I'm seeing. Let me know if you'd rather I separate that out into a new PR.

@alexcrichton
Copy link
Member

Thanks! Would it be easy enough to add a test for this as well?

Copy link
Member

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

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

Just the two comments.

The import-complex baseline will need updating, so you'll need to run the tests locally with BLESS=1 cargo test.

Regarding the tests, perhaps we should add a wit-component decode call on the composed bytes to ensure we can get back the wit definition.

@rylev rylev force-pushed the fix-broken-composed-encoding branch from 7c6c854 to 8e79c4d Compare April 14, 2023 18:40
@rylev rylev force-pushed the fix-broken-composed-encoding branch from 8e79c4d to 790635a Compare April 14, 2023 18:40
@rylev rylev requested a review from peterhuene April 14, 2023 21:22
Copy link
Member

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for fixing this!

Just the one minor nit and I think this is good to merge.

@rylev rylev requested a review from peterhuene April 16, 2023 08:37
@peterhuene peterhuene merged commit 6bd2794 into bytecodealliance:main Apr 16, 2023
@peterhuene
Copy link
Member

Thanks @rylev!

@rylev rylev deleted the fix-broken-composed-encoding branch April 16, 2023 16:55
Mossaka pushed a commit to Mossaka/wasm-tools-fork that referenced this pull request May 29, 2023
* Encode instance exports properly

* Fix tests

* Bless test

* Test component by decoding it with wit_component

* Make error message clearer
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.

wasm-tools compose creates invalid instances within the composed component

3 participants