diff --git a/src/parser_keywords.cpp b/src/parser_keywords.cpp index 982286ae2..ad720c344 100644 --- a/src/parser_keywords.cpp +++ b/src/parser_keywords.cpp @@ -22,9 +22,9 @@ static const wcstring subcommand_keywords[]{L"command", L"builtin", L"while", L" static const string_set_t block_keywords = {L"for", L"while", L"if", L"function", L"switch", L"begin"}; -static const wcstring reserved_keywords[] = {L"end", L"case", L"else", L"return", - L"continue", L"break", L"argparse", L"read", - L"set", L"status", L"test", L"["}; +static const wcstring reserved_keywords[] = { + 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"["}; // 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 diff --git a/tests/checks/string.fish b/tests/checks/string.fish index 44e6d613f..60eab3d89 100644 --- a/tests/checks/string.fish +++ b/tests/checks/string.fish @@ -681,3 +681,11 @@ echo $status yes | string replace -q y n echo $status # CHECK: 0 + +# `string` can't be wrapped properly anymore, since `string match` creates variables: +function string + builtin string $argv +end +# CHECKERR: checks/string.fish (line {{\d+}}): function: The name 'string' is reserved, and cannot be used as a function name +# CHECKERR: function string +# CHECKERR: ^