mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 13:23:09 +00:00
Fix error offset for command (foo)
This used the decorated statement offset when the expansion errors refer to the command without decoration.
This commit is contained in:
parent
a4fd3c194e
commit
eaf92918e6
2 changed files with 8 additions and 5 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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: <fish: Command substitutions not allowed>
|
||||
#CHECK: <command (asd)>
|
||||
#CHECK: < ^~~~^>
|
||||
true
|
||||
|
|
Loading…
Reference in a new issue