Describe the bug
In Vim9 script, we cannot pass an argument of type any to popup_create().
To Reproduce
Run this shell command:
vim -Nu NONE -S <(cat <<'EOF'
vim9script
def Func()
var what: any = ''
popup_create(what, {})
enddef
defcompile
EOF
)
This error is given:
E1013: Argument 1: type mismatch, expected string but got any
Expected behavior
No error is given.
Environment
Additional context
The {what} argument of popup_create() can be many things; including a number or a string. Thus, it makes sense to use a variable of type any for the first argument of popup_create().
No error is given at the script level:
vim9script vim9script var what: any = '' popup_create(what, {}) echo 'no error'
no error
Which is inconsistent.
If we give a number in compiled code, no error is given:
vim9script def Func() popup_create(123, {}) enddef defcompile echo 'no error'
no error
It means that Vim is ok with us giving a number to popup_create(). But that's not what the first error message said:
E1013: Argument 1: type mismatch, expected string but got any
^-------------^
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()