mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
fix(lua): allows tables with integer keys to be merged in tbl_deep_extend
- The exclusion of lists was never justified in the commit history and is the wrong thing to do for a function that deals with tables. - Move the error checks out of the recursive path. Fixes #23654
This commit is contained in:

committed by
Lewis Russell

parent
7b7c95dac9
commit
b6e350a6b4
@@ -1059,7 +1059,7 @@ describe('lua stdlib', function()
|
||||
local a = { a = {[2] = 3} }
|
||||
local b = { a = {[3] = 3} }
|
||||
local c = vim.tbl_deep_extend("force", a, b)
|
||||
return vim.deep_equal(c, {a = {[3] = 3}})
|
||||
return vim.deep_equal(c, {a = {[2] = 3, [3] = 3}})
|
||||
]]))
|
||||
|
||||
eq(
|
||||
@@ -1071,6 +1071,14 @@ describe('lua stdlib', function()
|
||||
]])
|
||||
)
|
||||
|
||||
-- Fix github issue #23654
|
||||
ok(exec_lua([[
|
||||
local a = { sub = { [1] = 'a' } }
|
||||
local b = { sub = { b = 'a' } }
|
||||
local c = vim.tbl_deep_extend('force', a, b)
|
||||
return vim.deep_equal(c, { sub = { [1] = 'a', b = 'a' } })
|
||||
]]))
|
||||
|
||||
matches(
|
||||
'invalid "behavior": nil',
|
||||
pcall_err(
|
||||
|
Reference in New Issue
Block a user