mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
fix
This commit is contained in:
parent
1663c9804c
commit
0a262a286e
3 changed files with 9 additions and 15 deletions
|
@ -1684,16 +1684,15 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
|
|||
}
|
||||
}
|
||||
out: for n in 0 .. arg_typ_sym.info.types.len {
|
||||
num_arg := n + 1
|
||||
curr_arg := arg_typs[n]
|
||||
multi_param := if func.is_variadic && i >= func.params.len - 1 {
|
||||
func.params.last()
|
||||
} else {
|
||||
func.params[i + n]
|
||||
func.params[n + i]
|
||||
}
|
||||
c.check_expected_call_arg(curr_arg, c.unwrap_generic(multi_param.typ),
|
||||
node.language, call_arg) or {
|
||||
c.error('${err.msg()} in argument ${i + num_arg} to `${fn_name}` from ${c.table.type_to_str(arg_typ)}',
|
||||
c.error('${err.msg()} in argument ${i + n + 1} to `${fn_name}` from ${c.table.type_to_str(arg_typ)}',
|
||||
call_arg.pos)
|
||||
continue out
|
||||
}
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
vlib/v/checker/tests/multi_return_arg_missing_err.vv:9:14: error: unknown function: ret_2
|
||||
vlib/v/checker/tests/multi_return_arg_missing_err.vv:9:14: error: expected 2 arguments, but got 3
|
||||
7 |
|
||||
8 | fn main() {
|
||||
9 | expect_2(1, ret_2())
|
||||
| ~~~~~~~
|
||||
10 | expect_2(returning_2(), 1)
|
||||
11 | }
|
||||
vlib/v/checker/tests/multi_return_arg_missing_err.vv:9:14: error: `ret_2()` (no value) used as value in argument 2 to `expect_2`
|
||||
7 |
|
||||
8 | fn main() {
|
||||
9 | expect_2(1, ret_2())
|
||||
| ~~~~~~~
|
||||
9 | expect_2(1, returning_2())
|
||||
| ~~~~~~~~~~~~~
|
||||
10 | expect_2(returning_2(), 1)
|
||||
11 | }
|
||||
Details: have (int literal, (int, int))
|
||||
want (int, int)
|
||||
vlib/v/checker/tests/multi_return_arg_missing_err.vv:10:26: error: expected 2 arguments, but got 3
|
||||
8 | fn main() {
|
||||
9 | expect_2(1, ret_2())
|
||||
9 | expect_2(1, returning_2())
|
||||
10 | expect_2(returning_2(), 1)
|
||||
| ^
|
||||
11 | }
|
||||
|
|
|
@ -6,6 +6,6 @@ fn returning_2() (int, int) {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
expect_2(1, ret_2())
|
||||
expect_2(1, returning_2())
|
||||
expect_2(returning_2(), 1)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue