mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 06:13:20 +00:00
b5739ddacf
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.
34 lines
996 B
Fish
34 lines
996 B
Fish
#RUN: %fish -C 'set -g fish %fish' %s
|
|
|
|
# A $status used as a command should not impact the location of other errors.
|
|
echo 'echo foo | exec grep # this exec is not allowed!
|
|
|
|
$status
|
|
|
|
# The error might be found here!' | $fish 2>| string replace -r '(.*)' '<$1>'
|
|
|
|
# CHECK: <fish: The 'exec' command can not be used in a pipeline>
|
|
# CHECK: <echo foo | exec grep # this exec is not allowed!>
|
|
# CHECK: < ^>
|
|
|
|
echo '
|
|
|
|
(true one)
|
|
(true two)
|
|
|
|
# more things
|
|
' | $fish 2>| string replace -r '(.*)' '<$1>'
|
|
|
|
# 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: < ^>
|