Steps to reproduce
Run this shell command:
vim -Nu NONE -S <(tee <<'EOF'
vim9script
def Func()
for [a: number, b: job] in [[0, '']]
endfor
enddef
Func()
EOF
)
This error is given:
E1013: Argument 2: type mismatch, expected job but got string
^------^
Notice how Vim refers to the b
iteration variable as an argument.
Expected behavior
This error is given:
E1013: Variable 2: type mismatch, expected job but got string
^------^
Notice how this time Vim refers to the b
iteration variable as a variable.
Version of Vim
8.2 Included patches: 1-4960
Environment
Operating system: Ubuntu 20.04.4 LTS
Terminal: xterm
Value of $TERM: xterm-256color
Shell: GNU bash, version 5.0.17
Additional context
The syntax which lets us iterate over multiple variables is documented below :help E1140
:
:for [{var1}, {var2}, ...] in {listlist}
:endfo[r] *E1140*
Like `:for` above, but each item in {listlist} must be
a list, of which each item is assigned to {var1},
{var2}, etc. Example: >
:for [lnum, col] in [[1, 3], [2, 5], [3, 8]]
:echo getline(lnum)[col]
:endfor
At no point is the word "argument" ever used. The identifiers which are used to iterate over the values are referred to as "var1", "var2", ... which are shorthands for "variable 1", "variable 2", ...
When unpacking a list, if an error must be given, Vim correctly uses the word "Variable", and not "Argument":
vim9script def Func() var a: number var b: job [a, b] = [0, ''] enddef Func()
E1163: Variable 2: type mismatch, expected job but got string
^------^
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.