-
Notifications
You must be signed in to change notification settings - Fork 15
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 #130 from rylev/implicit-import-check
- Loading branch information
Showing
9 changed files
with
201 additions
and
48 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
22 changes: 22 additions & 0 deletions
22
crates/wac-parser/tests/resolution/fail/targets-interface-use.wac
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,22 @@ | ||
package test:comp targets test:comp/foo; | ||
|
||
interface indirect-dependency { | ||
variant my-variant { | ||
foo, | ||
// Extra variant that the instance does not have | ||
bar | ||
} | ||
} | ||
|
||
interface direct-dependency { | ||
use indirect-dependency.{my-variant}; | ||
|
||
fun: func() -> my-variant; | ||
} | ||
|
||
world foo { | ||
import direct-dependency; | ||
} | ||
|
||
|
||
let i = new foo:bar { ... }; |
5 changes: 5 additions & 0 deletions
5
crates/wac-parser/tests/resolution/fail/targets-interface-use.wac.result
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 @@ | ||
failed to resolve document | ||
|
||
× import `test:comp/indirect-dependency` has a mismatched type for target world `test:comp/foo` | ||
├─▶ mismatched type for export `my-variant` | ||
╰─▶ expected a variant case count of 2, found a count of 1 |
19 changes: 19 additions & 0 deletions
19
crates/wac-parser/tests/resolution/fail/targets-interface-use/foo/bar.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,19 @@ | ||
(component | ||
(type (;0;) | ||
(instance | ||
(type (;0;) (variant (case "foo"))) | ||
(export (;1;) "my-variant" (type (eq 0))) | ||
) | ||
) | ||
(import "test:comp/indirect-dependency" (instance (;0;) (type 0))) | ||
(alias export 0 "my-variant" (type (;1;))) | ||
(type (;2;) | ||
(instance | ||
(alias outer 1 1 (type (;0;))) | ||
(export (;1;) "my-variant" (type (eq 0))) | ||
(type (;2;) (func (result 1))) | ||
(export (;0;) "fun" (func (type 2))) | ||
) | ||
) | ||
(import "test:comp/direct-dependency" (instance (;1;) (type 2))) | ||
) |
13 changes: 13 additions & 0 deletions
13
crates/wac-parser/tests/resolution/fail/targets-world-use.wac
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,13 @@ | ||
package test:comp targets test:comp/foo; | ||
|
||
interface indirect-dependency { | ||
// The resource is actually named "other-resource" in the instance | ||
resource my-resource {} | ||
} | ||
|
||
world foo { | ||
use indirect-dependency.{my-resource}; | ||
import my-func: func() -> my-resource; | ||
} | ||
|
||
let i = new foo:bar { ... }; |
4 changes: 4 additions & 0 deletions
4
crates/wac-parser/tests/resolution/fail/targets-world-use.wac.result
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,4 @@ | ||
failed to resolve document | ||
|
||
× import `test:comp/indirect-dependency` has a mismatched type for target world `test:comp/foo` | ||
╰─▶ instance has unexpected resource export `other-resource` |
14 changes: 14 additions & 0 deletions
14
crates/wac-parser/tests/resolution/fail/targets-world-use/foo/bar.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,14 @@ | ||
(component | ||
(type (;0;) | ||
(instance | ||
(export (;0;) "other-resource" (type (sub resource))) | ||
) | ||
) | ||
(import "test:comp/indirect-dependency" (instance (;0;) (type 0))) | ||
(alias export 0 "other-resource" (type (;1;))) | ||
(import "my-resource" (type (;2;) (eq 1))) | ||
(type (;3;) (own 2)) | ||
(type (;4;) (func (result 3))) | ||
(import "my-func" (func (;0;) (type 4))) | ||
(alias export 0 "other-resource" (type (;5;))) | ||
) |
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