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.
Fixes FuelLabs#3570
- Loading branch information
1 parent
10e098c
commit 5fc1750
Showing
7 changed files
with
117 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
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
58 changes: 56 additions & 2 deletions
58
test/src/e2e_vm_tests/test_programs/should_fail/abi_ref_mut/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 |
---|---|---|
@@ -1,11 +1,65 @@ | ||
contract; | ||
|
||
abi MyContract { | ||
fn test_function(p: u64); | ||
fn test_function1(p1: u64); | ||
fn test_function2(mut p2: u64); | ||
fn test_function3(ref mut p3: u64); | ||
fn test_function4(ref p4: u64); | ||
fn test_function5(p5: u64); | ||
fn test_function6(p6: u64); | ||
} | ||
|
||
impl MyContract for Contract { | ||
fn test_function(ref mut p: u64) { | ||
fn test_function1(ref mut p1: u64) { | ||
|
||
} | ||
fn test_function2(mut p2: u64) { | ||
|
||
} | ||
fn test_function3(ref mut p3: u64) { | ||
|
||
} | ||
fn test_function4(ref p4: u64) { | ||
|
||
} | ||
fn test_function5(ref p5: u64) { | ||
|
||
} | ||
fn test_function6(mut p6: u64) { | ||
|
||
} | ||
} | ||
|
||
trait MyTrait { | ||
fn check_function1(q1: u64); | ||
fn check_function2(mut q2: u64); | ||
fn check_function3(ref mut q3: u64); | ||
fn check_function4(ref q4: u64); | ||
fn check_function5(q5: u64); | ||
fn check_function6(q6: u64); | ||
} | ||
|
||
struct S { | ||
|
||
} | ||
|
||
impl MyTrait for S { | ||
fn check_function1(ref mut q1: u64) { | ||
|
||
} | ||
fn check_function2(mut q2: u64) { | ||
|
||
} | ||
fn check_function3(ref mut q3: u64) { | ||
|
||
} | ||
fn check_function4(ref q4: u64) { | ||
|
||
} | ||
fn check_function5(ref q5: u64) { | ||
|
||
} | ||
fn check_function6(mut q6: u64) { | ||
|
||
} | ||
} |
45 changes: 44 additions & 1 deletion
45
test/src/e2e_vm_tests/test_programs/should_fail/abi_ref_mut/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 |
---|---|---|
@@ -1,3 +1,46 @@ | ||
category = "fail" | ||
|
||
# check: $()Ref mutable parameter is not supported for contract ABI function. | ||
# ABI | ||
|
||
# check: $()error | ||
# check: $()fn test_function2(mut p2: u64); | ||
# nextln: $()ref mut or mut parameter is not allowed for contract ABI function | ||
|
||
# check: $()error | ||
# check: $()fn test_function3(ref mut p3: u64); | ||
# nextln: $()ref mut or mut parameter is not allowed for contract ABI function | ||
|
||
# check: $()error | ||
# check: $()fn test_function4(ref p4: u64); | ||
# nextln: $()ref mut or mut parameter is not allowed for contract ABI function | ||
|
||
# check: $()error | ||
# check: $()fn test_function1(ref mut p1: u64) { | ||
# nextln: $()Parameter reference type or mutability mismatch between the trait function declaration and its implementation | ||
|
||
# check: $()error | ||
# check: $()fn test_function5(ref p5: u64) { | ||
# nextln: $()Parameter reference type or mutability mismatch between the trait function declaration and its implementation | ||
|
||
# check: $()error | ||
# check: $()fn test_function6(mut p6: u64) { | ||
# nextln: $()Parameter reference type or mutability mismatch between the trait function declaration and its implementation | ||
|
||
#### Trait | ||
|
||
# check: $()error | ||
# check: $()fn check_function1(ref mut q1: u64) { | ||
# nextln: $()Parameter reference type or mutability mismatch between the trait function declaration and its implementation | ||
|
||
# check: $()error | ||
# check: $()fn check_function2(mut q2: u64); | ||
# nextln: $()This parameter was declared as mutable, which is not supported yet, did you mean to use ref mut? | ||
|
||
# check: $()error | ||
# check: $()fn check_function5(ref q5: u64) { | ||
# nextln: $()Parameter reference type or mutability mismatch between the trait function declaration and its implementation | ||
|
||
# check: $()error | ||
# check: $()fn check_function6(mut q6: u64) { | ||
# nextln: $()Parameter reference type or mutability mismatch between the trait function declaration and its implementation | ||
|
2 changes: 1 addition & 1 deletion
2
test/src/e2e_vm_tests/test_programs/should_fail/ref_mut_contract_abi/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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
category = "fail" | ||
|
||
# check: $()fn foo(ref mut x: u64); | ||
# nextln: $()ref mut parameter is not allowed for contract ABI function. | ||
# nextln: $()ref mut or mut parameter is not allowed for contract ABI function. |
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