-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from rylev/panic-repro
Fix panic when resource's owning interface is not otherwise implicitly imported
- Loading branch information
Showing
11 changed files
with
191 additions
and
12 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
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
9 changes: 9 additions & 0 deletions
9
crates/wac-graph/tests/graphs/implicit-resource-import/bar/deps/types.wit
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,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 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 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 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 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))) | ||
(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 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 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 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 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