-
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.
checker: check fixed array builtin method args mismatch
- Loading branch information
Showing
3 changed files
with
111 additions
and
0 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
90 changes: 90 additions & 0 deletions
90
vlib/v/checker/tests/fixed_array_builtin_method_args_err.out
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,90 @@ | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:4:11: error: `.index()` expected 1 argument, but got 0 | ||
2 | arr := [1, 2, 3]! | ||
3 | | ||
4 | _ := arr.index() | ||
| ~~~~~~~ | ||
5 | _ := arr.index('hello') | ||
6 | _ := arr.contains() | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:4:4: error: assignment mismatch: 1 variable but `index()` returns 0 values | ||
2 | arr := [1, 2, 3]! | ||
3 | | ||
4 | _ := arr.index() | ||
| ~~ | ||
5 | _ := arr.index('hello') | ||
6 | _ := arr.contains() | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:5:17: error: cannot use `string` as `int` in argument 1 to `.index()` | ||
3 | | ||
4 | _ := arr.index() | ||
5 | _ := arr.index('hello') | ||
| ~~~~~~~ | ||
6 | _ := arr.contains() | ||
7 | _ := arr.contains('hello') | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:5:4: error: assignment mismatch: 1 variable but `index()` returns 0 values | ||
3 | | ||
4 | _ := arr.index() | ||
5 | _ := arr.index('hello') | ||
| ~~ | ||
6 | _ := arr.contains() | ||
7 | _ := arr.contains('hello') | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:6:11: error: `.contains()` expected 1 argument, but got 0 | ||
4 | _ := arr.index() | ||
5 | _ := arr.index('hello') | ||
6 | _ := arr.contains() | ||
| ~~~~~~~~~~ | ||
7 | _ := arr.contains('hello') | ||
8 | _ := arr.any() | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:6:4: error: assignment mismatch: 1 variable but `contains()` returns 0 values | ||
4 | _ := arr.index() | ||
5 | _ := arr.index('hello') | ||
6 | _ := arr.contains() | ||
| ~~ | ||
7 | _ := arr.contains('hello') | ||
8 | _ := arr.any() | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:7:20: error: cannot use `string` as `int` in argument 1 to `.contains()` | ||
5 | _ := arr.index('hello') | ||
6 | _ := arr.contains() | ||
7 | _ := arr.contains('hello') | ||
| ~~~~~~~ | ||
8 | _ := arr.any() | ||
9 | _ := arr.any(22) | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:7:4: error: assignment mismatch: 1 variable but `contains()` returns 0 values | ||
5 | _ := arr.index('hello') | ||
6 | _ := arr.contains() | ||
7 | _ := arr.contains('hello') | ||
| ~~ | ||
8 | _ := arr.any() | ||
9 | _ := arr.any(22) | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:8:11: error: `.any` expected 1 argument, but got 0 | ||
6 | _ := arr.contains() | ||
7 | _ := arr.contains('hello') | ||
8 | _ := arr.any() | ||
| ~~~~~ | ||
9 | _ := arr.any(22) | ||
10 | _ := arr.all() | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:8:4: error: assignment mismatch: 1 variable but `any()` returns 0 values | ||
6 | _ := arr.contains() | ||
7 | _ := arr.contains('hello') | ||
8 | _ := arr.any() | ||
| ~~ | ||
9 | _ := arr.any(22) | ||
10 | _ := arr.all() | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:10:11: error: `.all` expected 1 argument, but got 0 | ||
8 | _ := arr.any() | ||
9 | _ := arr.any(22) | ||
10 | _ := arr.all() | ||
| ~~~~~ | ||
11 | _ := arr.all('hello') | ||
12 | } | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:10:4: error: assignment mismatch: 1 variable but `all()` returns 0 values | ||
8 | _ := arr.any() | ||
9 | _ := arr.any(22) | ||
10 | _ := arr.all() | ||
| ~~ | ||
11 | _ := arr.all('hello') | ||
12 | } | ||
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv:11:15: error: type mismatch, should use e.g. `all(it > 2)` | ||
9 | _ := arr.any(22) | ||
10 | _ := arr.all() | ||
11 | _ := arr.all('hello') | ||
| ~~~~~~~ | ||
12 | } |
12 changes: 12 additions & 0 deletions
12
vlib/v/checker/tests/fixed_array_builtin_method_args_err.vv
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,12 @@ | ||
fn main() { | ||
arr := [1, 2, 3]! | ||
|
||
_ := arr.index() | ||
_ := arr.index('hello') | ||
_ := arr.contains() | ||
_ := arr.contains('hello') | ||
_ := arr.any() | ||
_ := arr.any(22) | ||
_ := arr.all() | ||
_ := arr.all('hello') | ||
} |