Calling empty() on the return value of a void function (e.g., empty(F()) or F()->empty()) produces E340 rather than the expected E1186. The following script demonstrates it:
vim9script
var F: func = (): void => {
# Do nothing
}
try
echo F()
catch
echo v:exception # E1186 (as expected)
try
echo F()->empty()
catch
echo v:exception
# E340: Internal error; if you can reproduce please report a bug
endtry
endtry
E1186 should be given because it should fail earlier when the expression is evaluated as having no value rather than being passed to the builtin function, empty().
9.2.204
Same result on Windows 11 gVim 9.2.235 and WSL Arch Vim 9.2.204
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()