-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tighten and fix an assertion defining resource types (#1297)
This commit goes back to some comments I had on #1261 where an assertion was loosened there. My requested modifications ended up spawning #1293 so I've taken another look at this assertion to try to determine what's going on. I've managed to re-tighten the assertion while fixing the situation coming up in #1293 as well. The fix in this PR is to restructure the `_ty` method to iterate over the alias chain once and only define the type at the very end which should fix this for resources. I'm still having a difficult time fully explaining everything involved here but this feels like a more appropriate structure for the code at this time anyway.
- Loading branch information
1 parent
49d88f7
commit d87209e
Showing
4 changed files
with
106 additions
and
71 deletions.
There are no files selected for viewing
This file contains 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
1 change: 1 addition & 0 deletions
1
crates/wasm-compose/tests/compositions/resources-and-aliases/b.wat
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(component) |
44 changes: 44 additions & 0 deletions
44
crates/wasm-compose/tests/compositions/resources-and-aliases/composed.wat
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
(component | ||
(type (;0;) | ||
(instance | ||
(export (;0;) "a" (type (sub resource))) | ||
) | ||
) | ||
(import "host-a" (instance (;0;) (type 0))) | ||
(alias export 0 "a" (type (;1;))) | ||
(type (;2;) | ||
(instance | ||
(alias outer 1 1 (type (;0;))) | ||
(export (;1;) "b" (type (eq 0))) | ||
) | ||
) | ||
(import "host-b" (instance (;1;) (type 2))) | ||
(component (;0;) | ||
(type (;0;) | ||
(instance | ||
(export (;0;) "a" (type (sub resource))) | ||
) | ||
) | ||
(import "host-a" (instance $i (;0;) (type 0))) | ||
(alias export $i "a" (type $a (;1;))) | ||
(type (;2;) | ||
(instance | ||
(alias outer 1 $a (type (;0;))) | ||
(export (;1;) "b" (type (eq 0))) | ||
) | ||
) | ||
(import "host-b" (instance (;1;) (type 2))) | ||
(type (;3;) | ||
(instance) | ||
) | ||
(import "b" (instance (;2;) (type 3))) | ||
) | ||
(component (;1;)) | ||
(instance (;2;) (instantiate 1)) | ||
(instance (;3;) (instantiate 0 | ||
(with "b" (instance 2)) | ||
(with "host-a" (instance 0)) | ||
(with "host-b" (instance 1)) | ||
) | ||
) | ||
) |
11 changes: 11 additions & 0 deletions
11
crates/wasm-compose/tests/compositions/resources-and-aliases/root.wat
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
(component | ||
(import "host-a" (instance $i | ||
(export "a" (type (sub resource))) | ||
)) | ||
(alias export $i "a" (type $a)) | ||
(import "host-b" (instance | ||
(export "b" (type (eq $a))) | ||
)) | ||
|
||
(import "b" (instance)) | ||
) |