[vim/vim] Calling empty() on the return value of a void Vim9 script :def/lambda function gives E340 (Issue #19897)

1 view
Skip to first unread message

Peter Kenny

unread,
Apr 2, 2026, 10:20:11 PM (4 hours ago) Apr 2
to vim/vim, Subscribed
kennypete created an issue (vim/vim#19897)

Steps to reproduce

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

Expected behaviour

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().

Version of Vim

9.2.204

Environment

Same result on Windows 11 gVim 9.2.235 and WSL Arch Vim 9.2.204

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/19897@github.com>

Reply all
Reply to author
Forward
0 new messages