mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 14:23:09 +00:00
4ffabd44be
Like the $status commit, this would add the offset to already existing errors, so ```fish (foo) (bar) something ``` would see the "(foo)" error, store the correct error location, then see the "(bar)" error, and *add the offset of (bar)* to the "(foo)" error location. Solve this by making a new error list and appending it to the existing ones. There's a few other ways to solve this, including: - Stopping after the first error (we only display the first anyway, I think?) - Making it so the source location has an "absolute" flag that shows the offset has already been added (but do we ever need to add two offsets?) I went with the simpler fix.
24 lines
591 B
Fish
24 lines
591 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: <^>
|