-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes argument errors not displayed.
type_check_method_application does the parsing of arguments in 2 passes, but when the resolved_method_name failed the argument error would not be displayed. We now store the arg_handlers and append their errors in case resolve_method_name fails. Fixes #5660
- Loading branch information
Showing
5 changed files
with
94 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
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_fail/variable_does_not_exist/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-1C5801B8398D8ED4" | ||
|
||
[[package]] | ||
name = "variable_does_not_exist" | ||
source = "member" | ||
dependencies = ["core"] |
9 changes: 9 additions & 0 deletions
9
test/src/e2e_vm_tests/test_programs/should_fail/variable_does_not_exist/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,9 @@ | ||
[project] | ||
name = "variable_does_not_exist" | ||
authors = ["Fuel Labs <contact@fuel.sh>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
implicit-std = false | ||
|
||
[dependencies] | ||
core = { path = "../../../../../../sway-lib-core" } |
23 changes: 23 additions & 0 deletions
23
test/src/e2e_vm_tests/test_programs/should_fail/variable_does_not_exist/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,23 @@ | ||
script; | ||
|
||
struct S {} | ||
|
||
impl S { | ||
fn associated(a: u64, b: u64, c: u64) -> u64 { | ||
a + b + c | ||
} | ||
} | ||
|
||
fn function(a: u64, b: u64, c: u64) -> u64 { | ||
a + b + c | ||
} | ||
|
||
fn main() { | ||
let _ = S::associated(x, y, z); | ||
|
||
|
||
let _ = function(x, y, z); | ||
|
||
|
||
let _ = x + y + z; | ||
} |
31 changes: 31 additions & 0 deletions
31
test/src/e2e_vm_tests/test_programs/should_fail/variable_does_not_exist/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,31 @@ | ||
category = "fail" | ||
|
||
# check: $()let _ = S::associated(x, y, z); | ||
# nextln:$()Variable "x" does not exist in this scope. | ||
|
||
# check: $()let _ = S::associated(x, y, z); | ||
# nextln:$()Variable "y" does not exist in this scope. | ||
|
||
# check: $()let _ = S::associated(x, y, z); | ||
# nextln:$()Variable "z" does not exist in this scope. | ||
|
||
# check: $()let _ = function(x, y, z); | ||
# nextln:$()Variable "x" does not exist in this scope. | ||
|
||
# check: $()let _ = function(x, y, z); | ||
# nextln:$()Variable "y" does not exist in this scope. | ||
|
||
# check: $()let _ = function(x, y, z); | ||
# nextln:$()Variable "z" does not exist in this scope. | ||
|
||
# check: $()let _ = x + y + z; | ||
# nextln: $()Variable "x" does not exist in this scope. | ||
|
||
# check: $()let _ = x + y + z; | ||
# nextln: $()Variable "y" does not exist in this scope. | ||
|
||
# check: $()let _ = x + y + z; | ||
# nextln: $()No method named "add" found for type "{unknown}". | ||
|
||
# check: $()let _ = x + y + z; | ||
# nextln: $()Variable "z" does not exist in this scope. |