mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 08:39:37 +08:00
Fix error for vararg functions with zero arguments
This commit is contained in:
parent
c284c4ca99
commit
24fd26ae6e
|
@ -461,7 +461,9 @@ double state::base() {
|
|||
if (type_ != TOK_ERROR || error_ == TE_ERROR_UNEXPECTED_TOKEN) {
|
||||
// Otherwise we complain about the number of arguments *first*,
|
||||
// a closing parenthesis should be more obvious.
|
||||
error_ = i < arity ? TE_ERROR_TOO_FEW_ARGS : TE_ERROR_TOO_MANY_ARGS;
|
||||
//
|
||||
// Vararg functions need at least one argument.
|
||||
error_ = (i < arity || (arity == -1 && i == 0)) ? TE_ERROR_TOO_FEW_ARGS : TE_ERROR_TOO_MANY_ARGS;
|
||||
type_ = TOK_ERROR;
|
||||
if (first_err) {
|
||||
errpos_ = first_err;
|
||||
|
|
|
@ -109,6 +109,11 @@ not math 'ncr(1)'
|
|||
# CHECKERR: 'ncr(1)'
|
||||
# CHECKERR: ^
|
||||
|
||||
math "min()"
|
||||
# CHECKERR: math: Error: Too few arguments
|
||||
# CHECKERR: 'min()'
|
||||
# CHECKERR: ^
|
||||
|
||||
# There is no "blah" function.
|
||||
not math 'blah()'
|
||||
# CHECKERR: math: Error: Unknown function
|
||||
|
|
Loading…
Reference in New Issue
Block a user