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.
…abs#4431) ## Description The idea is to not check for Sway keywords when parsing the opcodes in `asm` blocks. This is important because some Sway keywords, such as `mod`, are also FuelVM opcodes. Note that the validity of the opcodes are later checked anyways so we're not losing any useful checks here. ## Checklist - [ ] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [x] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
- Loading branch information
1 parent
ed0f800
commit 83d5578
Showing
7 changed files
with
40 additions
and
8 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
3 changes: 3 additions & 0 deletions
3
test/src/e2e_vm_tests/test_programs/should_fail/unrecognized_opcode/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 = 'unrecognized_opcode' | ||
source = 'member' |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/unrecognized_opcode/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,8 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
license = "Apache-2.0" | ||
implicit-std = false | ||
name = "unrecognized_opcode" | ||
entry = "main.sw" | ||
|
||
[dependencies] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/unrecognized_opcode/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,8 @@ | ||
script; | ||
|
||
fn main() { | ||
let _x = asm (r1, r2: 0, r3: 0) { | ||
modd r1 r2 r3; | ||
r1: u64 | ||
}; | ||
} |
4 changes: 4 additions & 0 deletions
4
test/src/e2e_vm_tests/test_programs/should_fail/unrecognized_opcode/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: $()modd r1 r2 r3; | ||
# check: $()Unrecognized op code. |
2 changes: 1 addition & 1 deletion
2
test/src/e2e_vm_tests/test_programs/should_pass/language/asm_expr_basic/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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "asm_expr_basic" | ||
entry = "main.sw" | ||
|
||
[dependencies] | ||
std = { path = "../../../../../../../sway-lib-std" } |
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