diff --git a/src/parse_util.cpp b/src/parse_util.cpp index 7943adb74..9f90aac65 100644 --- a/src/parse_util.cpp +++ b/src/parse_util.cpp @@ -1225,7 +1225,10 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, } if (parse_errors) { - parse_error_offset_source_start(&new_errors, source_start); + // The expansion errors here go from the *command* onwards, + // so we need to offset them by the *command* offset, + // excluding the decoration. + parse_error_offset_source_start(&new_errors, dst.command.source_range().start); vec_append(*parse_errors, std::move(new_errors)); } } diff --git a/tests/checks/expansion.fish b/tests/checks/expansion.fish index 15435161f..52bdfb957 100644 --- a/tests/checks/expansion.fish +++ b/tests/checks/expansion.fish @@ -324,8 +324,8 @@ $fish -c 'echo {}}' #CHECKERR: fish: Unexpected '}' for unopened brace expansion #CHECKERR: echo {}} #CHECKERR: ^ -$fish -c 'command (asd)' -#CHECKERR: fish: Command substitutions not allowed -#CHECKERR: command (asd) -#CHECKERR: ^ +printf '<%s>\n' ($fish -c 'command (asd)' 2>&1) +#CHECK: +#CHECK: +#CHECK: < ^~~~^> true