Repository navigation
Reject worlds with interfaces that can access both imports and exports #1081
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
alexcrichton
merged 2 commits into
bytecodealliance:main
from
alexcrichton:reject-now-invalid-worlds
Jun 22, 2023
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
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 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 @@ | ||
| interface transitively depends on an interface in incompatible ways | ||
| --> 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 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,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 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 @@ | ||
| interface transitively depends on an interface in incompatible ways | ||
| --> 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 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 @@ | ||
| interface transitively depends on an interface in incompatible ways | ||
| --> tests/ui/parse-fail/import-and-export3.wit:36:10 | ||
| | | ||
| 36 | export i3 | ||
| | ^- |
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 |
|---|---|---|
|
|
@@ -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 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 @@ | ||
| interface transitively depends on an interface in incompatible ways | ||
| --> 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 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,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 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 @@ | ||
| interface transitively depends on an interface in incompatible ways | ||
| --> tests/ui/parse-fail/import-and-export5.wit:13:10 | ||
| | | ||
| 13 | export anon: interface { | ||
| | ^--- | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance, this error message seems confusing, because the import-and-export5.wit file doesn't contain the
importkeyword, so the user may not know what this is referring to.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I definitely agree, and that's the subject of this FIXME which I'm hoping to leave for later as an improvement. These sorts of error messages in my experience are possible but pretty difficult to write up and implement so I'd ideally like to make sure it's motivated first as opposed to "only I'll see this for years as I'm writing tests"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I hadn't seen the code yet :-). This makes sense. Perhaps a little different wording, perhaps "interface transitively depends on an interface in incompatible ways" or so, which would be a little less informative, but less likely to give people a misleading impression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me 👍