mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-11 05:31:14 -03:00
function: Also error for read-only var in positional arg
We have this hack where any positional arguments are taken as argument
names if "--argument-names" is given, and that didn't check for
read-only variables.
Fixes #11295
(cherry picked from commit d203ee4d53)
This commit is contained in:
@@ -183,6 +183,11 @@ function foo --argument-names status; end
|
||||
echo status $status
|
||||
# CHECK: status 2
|
||||
|
||||
function foo --argument-names foo status; end
|
||||
# CHECKERR: {{.*}}function.fish (line {{\d+}}): function: variable 'status' is read-only
|
||||
# CHECKERR: function foo --argument-names foo status; end
|
||||
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
|
||||
|
||||
functions -q foo
|
||||
echo exists $status
|
||||
# CHECK: exists 1
|
||||
|
||||
Reference in New Issue
Block a user