mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-28 12:45:13 +00:00
builtin _ is now a reserved keyword
Similar to `test`, `_` is so likely to at least slow down if not break all things catastrophically that it ought not be allowed as a function name. Fixes #8342
This commit is contained in:
parent
8784253282
commit
172601299f
2 changed files with 3 additions and 2 deletions
|
@ -45,7 +45,8 @@ Scripting improvements
|
||||||
- ``return`` can now be used outside of functions. In scripts it does the same thing as :ref:`exit <cmd-exit>`, in the commandline it sets ``$status`` without exiting (:issue:`8148`).
|
- ``return`` can now be used outside of functions. In scripts it does the same thing as :ref:`exit <cmd-exit>`, in the commandline it sets ``$status`` without exiting (:issue:`8148`).
|
||||||
- An oversight prevented all syntax checks from running on commands given to ``fish -c`` (:issue:`8171`). This includes checks like e.g. ``exec`` not being allowed in a pipeline and ``$$`` not being a valid variable. Most of these would have triggered an assert or other error before.
|
- An oversight prevented all syntax checks from running on commands given to ``fish -c`` (:issue:`8171`). This includes checks like e.g. ``exec`` not being allowed in a pipeline and ``$$`` not being a valid variable. Most of these would have triggered an assert or other error before.
|
||||||
- ``fish_indent`` now correctly reformats tokens that end with a backslash followed by a newline (:issue:`8197`).
|
- ``fish_indent`` now correctly reformats tokens that end with a backslash followed by a newline (:issue:`8197`).
|
||||||
- ``set`` learned a new option ``--function`` to set a variable in the function's top scope. This should be a more familiar way of scoping variables and avoids issues with ``--local``, which is actually block-scoped. (:issue:`565`, :issue:`8145`)::
|
- ``set`` learned a new option ``--function`` to set a variable in the function's top scope. This should be a more familiar way of scoping variables and avoids issues with ``--local``, which is actually block-scoped (:issue:`565`, :issue:`8145`).
|
||||||
|
- ``_`` is now a reserved keyword (:isues:`8342`).::
|
||||||
|
|
||||||
function demonstration
|
function demonstration
|
||||||
if true
|
if true
|
||||||
|
|
|
@ -24,7 +24,7 @@ static const string_set_t block_keywords = {L"for", L"while", L"if",
|
||||||
|
|
||||||
static const wcstring reserved_keywords[] = {
|
static const wcstring reserved_keywords[] = {
|
||||||
L"end", L"case", L"else", L"return", L"continue", L"break", L"argparse",
|
L"end", L"case", L"else", L"return", L"continue", L"break", L"argparse",
|
||||||
L"read", L"string", L"set", L"status", L"test", L"["};
|
L"read", L"string", L"set", L"status", L"test", L"[", L"_"};
|
||||||
|
|
||||||
// The lists above are purposely implemented separately from the logic below, so that future
|
// The lists above are purposely implemented separately from the logic below, so that future
|
||||||
// maintainers may assume the contents of the list based off their names, and not off what the
|
// maintainers may assume the contents of the list based off their names, and not off what the
|
||||||
|
|
Loading…
Reference in a new issue