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.
Adds a better error message in the case of using
ref
and deref
ex…
…pressions (FuelLabs#3687) Instead of using the Rust `unimplemented!()` macro, Sway users now see an "unimplemented" error from the Sway compiler when attempting to use `ref` or `deref` expressions. Closes FuelLabs#3677 Co-authored-by: emilyaherbert <[email protected]>
- Loading branch information
1 parent
aa54dba
commit 25f753b
Showing
7 changed files
with
65 additions
and
2 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
3 changes: 3 additions & 0 deletions
3
test/src/e2e_vm_tests/test_programs/should_fail/ref_and_deref_expressions/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 = 'ref_and_deref_expressions' | ||
source = 'member' |
6 changes: 6 additions & 0 deletions
6
test/src/e2e_vm_tests/test_programs/should_fail/ref_and_deref_expressions/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]>"] | ||
license = "Apache-2.0" | ||
name = "ref_and_deref_expressions" | ||
entry = "main.sw" | ||
implicit-std = false |
16 changes: 16 additions & 0 deletions
16
...src/e2e_vm_tests/test_programs/should_fail/ref_and_deref_expressions/json_abi_oracle.json
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,16 @@ | ||
[ | ||
{ | ||
"attributes": null, | ||
"inputs": [], | ||
"name": "main", | ||
"outputs": [ | ||
{ | ||
"components": null, | ||
"name": "", | ||
"type": "u32", | ||
"typeArguments": null | ||
} | ||
], | ||
"type": "function" | ||
} | ||
] |
16 changes: 16 additions & 0 deletions
16
test/src/e2e_vm_tests/test_programs/should_fail/ref_and_deref_expressions/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,16 @@ | ||
contract; | ||
|
||
abi MyContract { | ||
fn test_function() -> bool; | ||
} | ||
|
||
impl MyContract for Contract { | ||
fn test_function() -> bool { | ||
foo(ref Vec::new()); | ||
true | ||
} | ||
} | ||
|
||
pub fn foo(ref mut vec: Vec<u64>) { | ||
vec.push(1); | ||
} |
6 changes: 6 additions & 0 deletions
6
test/src/e2e_vm_tests/test_programs/should_fail/ref_and_deref_expressions/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,6 @@ | ||
category = "fail" | ||
|
||
# check: $()error | ||
# nextln: ref_and_deref_expressions/src/main.sw:9:13 | ||
# check: $()foo(ref Vec::new()); | ||
# nextln: $()Ref expressions are not supported yet. |