-
Notifications
You must be signed in to change notification settings - Fork 246
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
This commit introduces some extra checking (and panicking) for feature gates that are stable (i.e. `Stability::Stable`) AKA `@since` with a version and/or features specified. There are two primary changes: - Make referring to a *future* version of the package an error (for now) - Ensure that if a feature is specified that it is checked before inclusion 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
263b697
commit 8425d91
Showing
7 changed files
with
142 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
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,15 @@ | ||
// FAIL: component embed --dummy --wat % | ||
|
||
package test:invalid@0.1.0; | ||
|
||
interface foo { | ||
a: func(s: string) -> string; | ||
|
||
@since(version = 0.1.1) | ||
b: 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 gates cannot refer to an unreleased (future) package version [0.1.1] in package [test:invalid@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; | ||
|