mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: fix compiler crashes when passing an extra decompose parameter to a function(fix: 18995) (#18996)
This commit is contained in:
parent
a61a2fd328
commit
8586f18383
@ -2304,7 +2304,7 @@ fn (mut c Checker) check_expected_arg_count(mut node ast.CallExpr, f &ast.Fn) !
|
||||
has_decompose := node.args.filter(it.expr is ast.ArrayDecompose).len > 0
|
||||
if has_decompose {
|
||||
// if call(...args) is present
|
||||
min_required_params = nr_args
|
||||
min_required_params = nr_args - 1
|
||||
}
|
||||
}
|
||||
if min_required_params < 0 {
|
||||
|
@ -0,0 +1,6 @@
|
||||
vlib/v/checker/tests/fn_array_decompose_arg_mismatch_err_c.vv:2:6: error: expected 0 arguments, but got 1
|
||||
1 | fn main() {
|
||||
2 | foo(...args)
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
4 |
|
@ -0,0 +1,6 @@
|
||||
fn main() {
|
||||
foo(...args)
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
}
|
Loading…
Reference in New Issue
Block a user