Fix error for {$}

Fixes #9337
This commit is contained in:
Fabian Boehm 2022-11-15 19:02:30 +01:00
parent ce2f53237e
commit 0f8b9699a1
2 changed files with 16 additions and 0 deletions

View file

@ -866,6 +866,12 @@ static const wchar_t *error_format_for_character(wchar_t wc) {
case VARIABLE_EXPAND_EMPTY: {
return ERROR_NOT_PID;
}
case BRACE_END:
case L'}':
case L',':
case BRACE_SEP: {
return ERROR_NO_VAR_NAME;
}
default: {
return ERROR_BAD_VAR_CHAR1;
}

View file

@ -55,3 +55,13 @@ $fish -c "set -g fish_function_path $(string escape $TMPDIR); this_should_be_an_
# CHECKERR: fish:
# CHECKERR: set -g fish_function_path {{.*}}; this_should_be_an_error
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~^
$fish -c 'echo {$}'
# CHECKERR: fish: Expected a variable name after this $. <= no more checks
# CHECKERR: echo {$}
# CHECKERR: ^
$fish -c 'echo {$,}'
# CHECKERR: fish: Expected a variable name after this $.
# CHECKERR: echo {$,}
# CHECKERR: ^