-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(wit-parser): improve checking for stable feature gates (#1689)
This commit introduces some extra checking for stabilized feature gates (i.e. `@since` & in-code `Stability::Stable`) with a version and/or feature specified. There are two primary changes: - Ensure that packages containing a `@since` annotation must have a version specified - Referring to a future unreleased package version in a `@since` annotation is an error In the past `Stability::Stable` feature gates were simply treated as `Unknown`, which hides the information necessary for downstream crates/consumers to use (and created the question around whether referring to future package versions is valid). Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
- Loading branch information
1 parent
ad2a8ce
commit 4818141
Showing
14 changed files
with
166 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package foo:%from; | ||
|
||
interface a { | ||
use foo:foo/only-from.{r}; | ||
use foo:foo/only-from@1.0.0.{r}; | ||
|
||
foo: func(); | ||
} |
2 changes: 1 addition & 1 deletion
2
crates/wit-component/tests/merge/success/from/deps/foo/shared.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package foo:foo; | ||
package foo:foo@1.0.0; | ||
|
||
interface shared-only-from { | ||
variant v { | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package foo:into; | ||
|
||
interface b { | ||
use foo:foo/only-into.{r}; | ||
use foo:foo/only-into@1.0.0.{r}; | ||
|
||
foo: func(); | ||
} |
2 changes: 1 addition & 1 deletion
2
crates/wit-component/tests/merge/success/into/deps/foo/shared.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package foo:foo; | ||
package foo:foo@1.0.0; | ||
|
||
interface shared-only-into { | ||
variant v { | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package foo:foo; | ||
package foo:foo@1.0.0; | ||
|
||
interface only-into { | ||
record r { | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package foo:%from; | ||
|
||
interface a { | ||
use foo:foo/only-from.{r}; | ||
use foo:foo/only-from@1.0.0.{r}; | ||
|
||
foo: func(); | ||
} | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package foo:into; | ||
|
||
interface b { | ||
use foo:foo/only-into.{r}; | ||
use foo:foo/only-into@1.0.0.{r}; | ||
|
||
foo: func(); | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// FAIL: component embed --dummy % | ||
|
||
package test:invalid@0.1.0; | ||
|
||
interface foo { | ||
a: func(s: string) -> string; | ||
|
||
@since(version = 0.1.1) | ||
b: func(s: string) -> string; | ||
|
||
@since(version = 0.1.1, feature = c-please) | ||
c: func(s: string) -> string; | ||
} | ||
|
||
world test { | ||
import foo; | ||
export foo; | ||
} |
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 @@ | ||
error: failed to process feature gate for function [b] in package [test:invalid@0.1.0] | ||
|
||
Caused by: | ||
0: feature gate cannot reference unreleased version 0.1.1 of package [test:invalid@0.1.0] (current version 0.1.0) |
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// RUN: component wit % | ||
|
||
package a:b; | ||
package a:b@1.0.0; | ||
|
||
interface foo { | ||
type t = u32; | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/// RUN: component wit % | ||
package a:b; | ||
package a:b@1.0.0; | ||
|
||
interface foo { | ||
type t = u32; | ||
|