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.
Fix error message for arity mismatch on method calls (FuelLabs#3416)
close FuelLabs#2949 Co-authored-by: Mohammad Fawaz <[email protected]>
- Loading branch information
1 parent
395c2ab
commit 7fb338f
Showing
24 changed files
with
197 additions
and
12 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
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/excess_associated_fn_arguments/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,8 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-38536451AF31C078' | ||
|
||
[[package]] | ||
name = 'excess_associated_fn_arguments' | ||
source = 'member' | ||
dependencies = ['core'] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/excess_associated_fn_arguments/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" | ||
name = "excess_associated_fn_arguments" | ||
entry = "main.sw" | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../sway-lib-core" } |
1 change: 1 addition & 0 deletions
1
...2e_vm_tests/test_programs/should_fail/excess_associated_fn_arguments/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 @@ | ||
[] |
21 changes: 21 additions & 0 deletions
21
test/src/e2e_vm_tests/test_programs/should_fail/excess_associated_fn_arguments/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,21 @@ | ||
script; | ||
|
||
struct Data { | ||
value: u64 | ||
} | ||
|
||
impl Data { | ||
fn add_values(self, other: Data) -> u64 { | ||
self.value + other.value | ||
} | ||
} | ||
|
||
fn main() -> u64 { | ||
let data1 = Data { | ||
value: 42u64 | ||
}; | ||
let data2 = Data { | ||
value: 1u64 | ||
}; | ||
Data::add_values(data1, data2, data2) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/src/e2e_vm_tests/test_programs/should_fail/excess_associated_fn_arguments/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,3 @@ | ||
category = "fail" | ||
|
||
# check: $()Function "add_values" expects 2 arguments but you provided 3. |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/excess_method_arguments/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,8 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-5BDABAFA31FD4CEA' | ||
|
||
[[package]] | ||
name = 'excess_method_arguments' | ||
source = 'member' | ||
dependencies = ['core'] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/excess_method_arguments/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" | ||
name = "excess_method_arguments" | ||
entry = "main.sw" | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../sway-lib-core" } |
1 change: 1 addition & 0 deletions
1
test/src/e2e_vm_tests/test_programs/should_fail/excess_method_arguments/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 @@ | ||
[] |
21 changes: 21 additions & 0 deletions
21
test/src/e2e_vm_tests/test_programs/should_fail/excess_method_arguments/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,21 @@ | ||
script; | ||
|
||
struct Data { | ||
value: u64 | ||
} | ||
|
||
impl Data { | ||
fn add_values(self, other: Data) -> u64 { | ||
self.value + other.value | ||
} | ||
} | ||
|
||
fn main() -> u64 { | ||
let data1 = Data { | ||
value: 42u64 | ||
}; | ||
let data2 = Data { | ||
value: 1u64 | ||
}; | ||
data1.add_values(data2, data2) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/src/e2e_vm_tests/test_programs/should_fail/excess_method_arguments/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,3 @@ | ||
category = "fail" | ||
|
||
# check: $()Method "add_values" expects 1 argument but you provided 2. |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/missing_associated_fn_arguments/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,8 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-517D1536FEF54B89' | ||
|
||
[[package]] | ||
name = 'missing_associated_fn_arguments' | ||
source = 'member' | ||
dependencies = ['core'] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/missing_associated_fn_arguments/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" | ||
name = "missing_associated_fn_arguments" | ||
entry = "main.sw" | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../sway-lib-core" } |
1 change: 1 addition & 0 deletions
1
...e_vm_tests/test_programs/should_fail/missing_associated_fn_arguments/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 @@ | ||
[] |
21 changes: 21 additions & 0 deletions
21
test/src/e2e_vm_tests/test_programs/should_fail/missing_associated_fn_arguments/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,21 @@ | ||
script; | ||
|
||
struct Data { | ||
value: u64 | ||
} | ||
|
||
impl Data { | ||
fn add_values(self, other: Data) -> u64 { | ||
self.value + other.value | ||
} | ||
} | ||
|
||
fn main() -> u64 { | ||
let data1 = Data { | ||
value: 42u64 | ||
}; | ||
let data2 = Data { | ||
value: 1u64 | ||
}; | ||
Data::add_values(data1) | ||
} |
3 changes: 3 additions & 0 deletions
3
test/src/e2e_vm_tests/test_programs/should_fail/missing_associated_fn_arguments/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,3 @@ | ||
category = "fail" | ||
|
||
# check: $()Function "add_values" expects 2 arguments but you provided 1. |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/missing_method_arguments/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,8 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-02CB52E4F1733F6E' | ||
|
||
[[package]] | ||
name = 'missing_method_arguments' | ||
source = 'member' | ||
dependencies = ['core'] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/missing_method_arguments/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" | ||
name = "missing_method_arguments" | ||
entry = "main.sw" | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../sway-lib-core" } |
1 change: 1 addition & 0 deletions
1
.../src/e2e_vm_tests/test_programs/should_fail/missing_method_arguments/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 @@ | ||
[] |
21 changes: 21 additions & 0 deletions
21
test/src/e2e_vm_tests/test_programs/should_fail/missing_method_arguments/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,21 @@ | ||
script; | ||
|
||
struct Data { | ||
value: u64 | ||
} | ||
|
||
impl Data { | ||
fn add_values(self, other: Data) -> u64 { | ||
self.value + other.value | ||
} | ||
} | ||
|
||
fn main() -> u64 { | ||
let data1 = Data { | ||
value: 42u64 | ||
}; | ||
let data2 = Data { | ||
value: 1u64 | ||
}; | ||
data1.add_values() | ||
} |
3 changes: 3 additions & 0 deletions
3
test/src/e2e_vm_tests/test_programs/should_fail/missing_method_arguments/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,3 @@ | ||
category = "fail" | ||
|
||
# check: $()Method "add_values" expects 1 argument but you provided 0. |