forked from bytecodealliance/wasm-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reject worlds with interfaces that can access both imports and exports
This commit is a fix for the issue described in WebAssembly/component-model#208. The process of elaborating a world's exports is no longer as straightforward as imports and additionally is no longer infallible. Instead metadata is tracked to ensure that transitively added imports are always used as imports and never both as imports and exports.
- Loading branch information
1 parent
a41e2d0
commit 4ee0138
Showing
11 changed files
with
206 additions
and
22 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
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/parse-fail/import-and-export1.wit.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 @@ | ||
interface transitively depends on both an imported and exported copy of the same interface | ||
--> tests/ui/parse-fail/import-and-export1.wit:16:10 | ||
| | ||
16 | export i3 | ||
| ^- |
18 changes: 18 additions & 0 deletions
18
crates/wit-parser/tests/ui/parse-fail/import-and-export2.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,18 @@ | ||
package foo:foo | ||
|
||
interface foo { | ||
type t = u32 | ||
} | ||
|
||
interface bar { | ||
use foo.{t} | ||
} | ||
|
||
world baz { | ||
export foo | ||
import bar | ||
export anon: interface { | ||
use foo.{t} | ||
use bar.{t as t2} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/parse-fail/import-and-export2.wit.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 @@ | ||
interface transitively depends on both an imported and exported copy of the same interface | ||
--> tests/ui/parse-fail/import-and-export2.wit:14:10 | ||
| | ||
14 | export anon: interface { | ||
| ^--- |
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/parse-fail/import-and-export3.wit.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 @@ | ||
interface transitively depends on both an imported and exported copy of the same interface | ||
--> tests/ui/parse-fail/import-and-export3.wit:36:10 | ||
| | ||
36 | export i3 | ||
| ^- |
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 |
---|---|---|
|
@@ -41,4 +41,4 @@ world test { | |
import i3 | ||
export i1 | ||
export i3 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/parse-fail/import-and-export4.wit.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 @@ | ||
interface transitively depends on both an imported and exported copy of the same interface | ||
--> tests/ui/parse-fail/import-and-export4.wit:43:10 | ||
| | ||
43 | export i3 | ||
| ^- |
18 changes: 18 additions & 0 deletions
18
crates/wit-parser/tests/ui/parse-fail/import-and-export5.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,18 @@ | ||
package foo:bar | ||
|
||
interface a { | ||
record x { | ||
} | ||
} | ||
|
||
interface b { | ||
use a.{x} | ||
} | ||
|
||
world w { | ||
export anon: interface { | ||
use b.{x as x2} | ||
use a.{x} | ||
} | ||
export a | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/parse-fail/import-and-export5.wit.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 @@ | ||
interface transitively depends on both an imported and exported copy of the same interface | ||
--> tests/ui/parse-fail/import-and-export5.wit:13:10 | ||
| | ||
13 | export anon: interface { | ||
| ^--- |