mirror of
https://github.com/neovim/neovim.git
synced 2026-04-02 05:39:26 +00:00
fix(lua)!: do not use typed table for empty dict
Problem:
Empty dictionaries are converted into typed tables of the form `{ [true]
= 6}` instead of an empty dictionary representation `{}`. This leads to
incorrect table representation, along with failure in JSON encoding of
such tables as currently tables with only string and number type keys
can be encoded.
Solution:
The typed table logic has been removed from `nlua_push_Dictionary`. The
typed table logic is required only for float value conversions which is
already handled in `nlua_push_Float`. So, it is(was) no longer required
here.
Fixes neovim/neovim#29218
This commit is contained in:
@@ -1205,8 +1205,7 @@ describe('lua stdlib', function()
|
||||
]])
|
||||
eq(true, exec_lua([[return next(vim.fn.FooFunc(3)) == nil ]]))
|
||||
eq(3, eval('g:test'))
|
||||
-- compat: nvim_call_function uses "special" value for empty dict
|
||||
eq(true, exec_lua([[return next(vim.api.nvim_call_function("FooFunc", {5})) == true ]]))
|
||||
eq(true, exec_lua([[return vim.tbl_isempty(vim.api.nvim_call_function("FooFunc", {5}))]]))
|
||||
eq(5, eval('g:test'))
|
||||
|
||||
eq({ 2, 'foo', true }, exec_lua([[return vim.fn.VarArg(2, "foo", true)]]))
|
||||
|
||||
Reference in New Issue
Block a user