diff --git a/vlib/compiler/fn.v b/vlib/compiler/fn.v index 6e7f61aaff..81290477aa 100644 --- a/vlib/compiler/fn.v +++ b/vlib/compiler/fn.v @@ -1051,11 +1051,8 @@ fn (p mut Parser) fn_call_args(f mut Fn) { if p.tok != .comma && !is_variadic { p.error('wrong number of arguments for $i,$arg.name fn `$f.name`: expected $f.args.len, but got less') } - if p.tok == .comma { - p.fgen(', ') - } - if !is_variadic { - p.next() + if p.tok == .comma && (!is_variadic || (is_variadic && i < f.args.len-2 )) { + p.check(.comma) p.gen(',') } }