Skip to content

Commit 2f60bf8

Browse files
committed
Reproduce issue
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
1 parent ac04147 commit 2f60bf8

8 files changed

Lines changed: 106 additions & 0 deletions

File tree

crates/wac-graph/tests/encoding.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ impl GraphFile {
171171
path = path.display()
172172
)
173173
})?,
174+
None if path.is_dir() => Self::load_wit_package(test_case, &path)?,
174175
_ => bail!(
175176
"unexpected file extension for package file `{path}`",
176177
path = package.path.display()
@@ -331,6 +332,7 @@ fn encoding() -> Result<()> {
331332
})?
332333
.into_composition_graph(&path, test_case)
333334
.and_then(|graph| {
335+
println!("{:?}", graph);
334336
graph
335337
.encode(EncodeOptions {
336338
// We import the component definitions instead
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package foo:dependency;
2+
3+
interface types {
4+
resource x;
5+
}
6+
7+
world w {
8+
export types;
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package foo:bar;
2+
3+
world w {
4+
export foo:dependency/types;
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package foo:dependency;
2+
3+
interface types {
4+
resource x;
5+
}
6+
7+
world w {
8+
export types;
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package foo:baz;
2+
3+
world w {
4+
use foo:dependency/types.{x};
5+
import my-func: func() -> x;
6+
// The test will fail whether this is here or not
7+
import foo:dependency/types;
8+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"packages": [
3+
{
4+
"name": "foo:import",
5+
"path": "import"
6+
},
7+
{
8+
"name": "test:bar",
9+
"path": "bar"
10+
},
11+
{
12+
"name": "test:baz",
13+
"path": "baz"
14+
}
15+
],
16+
"nodes": [
17+
{
18+
"type": "import",
19+
"name": "foo:test-import/my-interface",
20+
"package": 0,
21+
"export": "foo:test-import/my-interface"
22+
},
23+
{
24+
"type": "instantiation",
25+
"package": 1
26+
},
27+
{
28+
"type": "alias",
29+
"source": 0,
30+
"export": "my-func"
31+
},
32+
{
33+
"type": "alias",
34+
"source": 1,
35+
"export": "foo:dependency/types"
36+
},
37+
{
38+
"type": "instantiation",
39+
"package": 2
40+
}
41+
],
42+
"arguments": [
43+
{
44+
"source": 2,
45+
"target": 4,
46+
"name": "my-func"
47+
},
48+
{
49+
"source": 3,
50+
"target": 4,
51+
"name": "foo:dependency/types"
52+
}
53+
]
54+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package foo:dependency;
2+
3+
interface types {
4+
resource x;
5+
}
6+
7+
world w {
8+
export types;
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package foo:test-import;
2+
3+
world w {
4+
export my-interface;
5+
}
6+
7+
interface my-interface{
8+
use foo:dependency/types.{x};
9+
my-func: func() -> x;
10+
}

0 commit comments

Comments
 (0)