-
Notifications
You must be signed in to change notification settings - Fork 30
Fix panic when resource's owning interface is not otherwise implicitly imported #101
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
9 changes: 9 additions & 0 deletions
9
crates/wac-graph/tests/graphs/implicit-resource-import/bar/deps/types.wit
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package foo:dependency; | ||
|
|
||
| interface types { | ||
| resource x; | ||
| } | ||
|
|
||
| world w { | ||
| export types; | ||
| } |
5 changes: 5 additions & 0 deletions
5
crates/wac-graph/tests/graphs/implicit-resource-import/bar/world.wit
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package foo:bar; | ||
|
|
||
| world w { | ||
| export foo:dependency/types; | ||
| } |
9 changes: 9 additions & 0 deletions
9
crates/wac-graph/tests/graphs/implicit-resource-import/baz/deps/types.wit
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package foo:dependency; | ||
|
|
||
| interface types { | ||
| resource x; | ||
| } | ||
|
|
||
| world w { | ||
| export types; | ||
| } |
8 changes: 8 additions & 0 deletions
8
crates/wac-graph/tests/graphs/implicit-resource-import/baz/world.wit
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package foo:baz; | ||
|
|
||
| world w { | ||
| use foo:dependency/types.{x}; | ||
| import my-func: func() -> x; | ||
| // The test will fail whether this is here or not | ||
| import foo:dependency/types; | ||
| } |
57 changes: 57 additions & 0 deletions
57
crates/wac-graph/tests/graphs/implicit-resource-import/encoded.wat
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| (component | ||
| (type (;0;) | ||
| (instance | ||
| (export (;0;) "x" (type (sub resource))) | ||
| ) | ||
| ) | ||
| (import "foo:dependency/types" (instance (;0;) (type 0))) | ||
| (alias export 0 "x" (type (;1;))) | ||
| (import "x" (type (;2;) (eq 1))) | ||
peterhuene marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| (alias export 0 "x" (type (;3;))) | ||
| (type (;4;) | ||
| (instance | ||
| (alias outer 1 3 (type (;0;))) | ||
| (export (;1;) "x" (type (eq 0))) | ||
| (type (;2;) (own 1)) | ||
| (type (;3;) (func (result 2))) | ||
| (export (;0;) "my-func" (func (type 3))) | ||
| ) | ||
| ) | ||
| (import "foo:test-import/my-interface" (instance (;1;) (type 4))) | ||
| (type (;5;) | ||
| (component | ||
| (type (;0;) | ||
| (instance | ||
| (export (;0;) "x" (type (sub resource))) | ||
| ) | ||
| ) | ||
| (export (;0;) "foo:dependency/types" (instance (type 0))) | ||
| ) | ||
| ) | ||
| (import "unlocked-dep=<test:bar>" (component (;0;) (type 5))) | ||
| (instance (;2;) (instantiate 0)) | ||
| (alias export 1 "my-func" (func (;0;))) | ||
| (alias export 2 "foo:dependency/types" (instance (;3;))) | ||
| (type (;6;) | ||
| (component | ||
| (type (;0;) | ||
| (instance | ||
| (export (;0;) "x" (type (sub resource))) | ||
| ) | ||
| ) | ||
| (import "foo:dependency/types" (instance (;0;) (type 0))) | ||
| (alias outer 1 3 (type (;1;))) | ||
| (import "x" (type (;2;) (eq 1))) | ||
| (type (;3;) (own 2)) | ||
| (type (;4;) (func (result 3))) | ||
| (import "my-func" (func (;0;) (type 4))) | ||
| ) | ||
| ) | ||
| (import "unlocked-dep=<test:baz>" (component (;1;) (type 6))) | ||
| (instance (;4;) (instantiate 1 | ||
| (with "foo:dependency/types" (instance 3)) | ||
| (with "my-func" (func 0)) | ||
| (with "x" (type 2)) | ||
| ) | ||
| ) | ||
| ) | ||
54 changes: 54 additions & 0 deletions
54
crates/wac-graph/tests/graphs/implicit-resource-import/graph.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| { | ||
| "packages": [ | ||
| { | ||
| "name": "foo:import", | ||
| "path": "import" | ||
| }, | ||
| { | ||
| "name": "test:bar", | ||
| "path": "bar" | ||
| }, | ||
| { | ||
| "name": "test:baz", | ||
| "path": "baz" | ||
| } | ||
| ], | ||
| "nodes": [ | ||
| { | ||
| "type": "import", | ||
| "name": "foo:test-import/my-interface", | ||
| "package": 0, | ||
| "export": "foo:test-import/my-interface" | ||
| }, | ||
| { | ||
| "type": "instantiation", | ||
| "package": 1 | ||
| }, | ||
| { | ||
| "type": "alias", | ||
| "source": 0, | ||
| "export": "my-func" | ||
| }, | ||
| { | ||
| "type": "alias", | ||
| "source": 1, | ||
| "export": "foo:dependency/types" | ||
| }, | ||
| { | ||
| "type": "instantiation", | ||
| "package": 2 | ||
| } | ||
| ], | ||
| "arguments": [ | ||
| { | ||
| "source": 2, | ||
| "target": 4, | ||
| "name": "my-func" | ||
| }, | ||
| { | ||
| "source": 3, | ||
| "target": 4, | ||
| "name": "foo:dependency/types" | ||
| } | ||
| ] | ||
| } |
9 changes: 9 additions & 0 deletions
9
crates/wac-graph/tests/graphs/implicit-resource-import/import/deps/types.wit
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package foo:dependency; | ||
|
|
||
| interface types { | ||
| resource x; | ||
| } | ||
|
|
||
| world w { | ||
| export types; | ||
| } |
10 changes: 10 additions & 0 deletions
10
crates/wac-graph/tests/graphs/implicit-resource-import/import/world.wit
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package foo:test-import; | ||
|
|
||
| world w { | ||
| export my-interface; | ||
| } | ||
|
|
||
| interface my-interface{ | ||
| use foo:dependency/types.{x}; | ||
| my-func: func() -> x; | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.