mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 18:21:16 -03:00
Report sub-token error locations again
This fixes a regression about where we report errors:
echo error(here
old: ^
fixed: ^
Commit 0c22f67bd (Remove the old parser bits, 2020-07-02) removed
uses of "error_offset_within_token" so we always report errors at
token start. Add it back, hopefully restoring the 3.1.2 behavior.
Note that for cases like
echo "$("
we report "unbalanced quotes" because we treat the $( as double
quote. Giving a better error seems hard because of the ambguity -
we don't know if quote is meant to be inside or outside the command
substitution.
This commit is contained in:
@@ -22,3 +22,13 @@ echo '
|
||||
# CHECK: <fish: Command substitutions not allowed>
|
||||
# CHECK: <(true one)>
|
||||
# CHECK: <^>
|
||||
|
||||
$fish -c 'echo "unfinished "(subshell' 2>| string replace -r '.*' '<$0>'
|
||||
# CHECK: <fish: Unexpected end of string, expecting ')'>
|
||||
# CHECK: <echo "unfinished "(subshell>
|
||||
# CHECK: < ^>
|
||||
|
||||
$fish -c 'echo "unfinished "$(subshell' 2>| string replace -r '.*' '<$0>'
|
||||
# CHECK: <fish: Unexpected end of string, expecting ')'>
|
||||
# CHECK: <echo "unfinished "$(subshell>
|
||||
# CHECK: < ^>
|
||||
|
||||
Reference in New Issue
Block a user