diff --git a/src/parse_util.cpp b/src/parse_util.cpp index 9671bfeec..2551068f3 100644 --- a/src/parse_util.cpp +++ b/src/parse_util.cpp @@ -1111,7 +1111,6 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, // We see this surprisingly regularly. const wcstring &com = dst.command.source(buff_src, storage); if (com == L"$status") { - parse_error_offset_source_start(parse_errors, source_start); errored = append_syntax_error(parse_errors, source_start, _(L"$status is not valid as a command. See `help conditions`")); diff --git a/tests/checks/syntax-error-location.fish b/tests/checks/syntax-error-location.fish new file mode 100644 index 000000000..59e7c95c3 --- /dev/null +++ b/tests/checks/syntax-error-location.fish @@ -0,0 +1,12 @@ +#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: +# CHECK: +# CHECK: < ^>