forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add conditional compilation by
program_type
(FuelLabs#4393)
This is a followup for FuelLabs#4292 which adds the `program_type` argument for the `cfg` attribute. Should unblock FuelLabs#3829 (comment)
- Loading branch information
Showing
15 changed files
with
127 additions
and
10 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
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
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
3 changes: 3 additions & 0 deletions
3
...e2e_vm_tests/test_programs/should_fail/conditional_compilation/bad_program_type/Forc.lock
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,3 @@ | ||
[[package]] | ||
name = 'conditional_compilation_bad_program_type' | ||
source = 'member' |
6 changes: 6 additions & 0 deletions
6
...e2e_vm_tests/test_programs/should_fail/conditional_compilation/bad_program_type/Forc.toml
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,6 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
implicit-std = false | ||
license = "Apache-2.0" | ||
name = "conditional_compilation_bad_program_type" |
6 changes: 6 additions & 0 deletions
6
...e_vm_tests/test_programs/should_fail/conditional_compilation/bad_program_type/src/main.sw
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,6 @@ | ||
script; | ||
|
||
#[cfg(program_type = "scriptz")] | ||
fn main() { | ||
() | ||
} |
4 changes: 4 additions & 0 deletions
4
...e2e_vm_tests/test_programs/should_fail/conditional_compilation/bad_program_type/test.toml
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 @@ | ||
category = "fail" | ||
|
||
# check: $()#[cfg(program_type = "scriptz")] | ||
# nextln: $()Invalid value ""scriptz"" |
3 changes: 3 additions & 0 deletions
3
...ests/test_programs/should_fail/conditional_compilation/mismatching_program_type/Forc.lock
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,3 @@ | ||
[[package]] | ||
name = 'conditional_compilation_mismatching_program_type' | ||
source = 'member' |
6 changes: 6 additions & 0 deletions
6
...ests/test_programs/should_fail/conditional_compilation/mismatching_program_type/Forc.toml
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,6 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
implicit-std = false | ||
license = "Apache-2.0" | ||
name = "conditional_compilation_mismatching_program_type" |
10 changes: 10 additions & 0 deletions
10
...ts/test_programs/should_fail/conditional_compilation/mismatching_program_type/src/main.sw
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,10 @@ | ||
script; | ||
|
||
#[cfg(program_type = "predicate")] | ||
fn foo() { | ||
() | ||
} | ||
|
||
fn main() { | ||
foo() | ||
} |
4 changes: 4 additions & 0 deletions
4
...ests/test_programs/should_fail/conditional_compilation/mismatching_program_type/test.toml
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 @@ | ||
category = "fail" | ||
|
||
# check: $()foo() | ||
# nextln: $()Could not find symbol "foo" in this scope. |
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