-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix WIT sugar for resource names being
own<T>
This commit fixes an issue where WIT resources should not have to be wrapped in `own<T>` but instead are allowed to be defined as just `T`. This is a bit tricky when `T` is defined in a foreign package since the "inject the `own` wrapper" isn't apparent during parsing but only later once packages are merged together. This phase has been updated accordingly to inject `own` wrappers as necessary.
- Loading branch information
1 parent
e84e3ee
commit 2afe9b1
Showing
7 changed files
with
118 additions
and
43 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
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/name-both-resource-and-type/deps/dep/foo.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 some:dep | ||
|
||
interface foo { | ||
resource a | ||
} |
8 changes: 8 additions & 0 deletions
8
crates/wit-parser/tests/ui/name-both-resource-and-type/foo.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:bar | ||
|
||
interface foo { | ||
use some:dep/foo.{a} | ||
|
||
type t1 = a | ||
type t2 = borrow<a> | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/parse-fail/type-and-resource-same-name.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 @@ | ||
type is not a resource | ||
--> tests/ui/parse-fail/type-and-resource-same-name/foo.wit:7:20 | ||
| | ||
7 | type t2 = borrow<a> | ||
| ^ |
5 changes: 5 additions & 0 deletions
5
crates/wit-parser/tests/ui/parse-fail/type-and-resource-same-name/deps/dep/foo.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 some:dep | ||
|
||
interface foo { | ||
type a = u32 | ||
} |
8 changes: 8 additions & 0 deletions
8
crates/wit-parser/tests/ui/parse-fail/type-and-resource-same-name/foo.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:bar | ||
|
||
interface foo { | ||
use some:dep/foo.{a} | ||
|
||
type t1 = a | ||
type t2 = borrow<a> | ||
} |