Fix merge bug

This commit is contained in:
hrsh7th
2021-08-29 14:31:24 +09:00
parent 99de62c1fc
commit a339421f4b
3 changed files with 32 additions and 3 deletions

View File

@@ -21,8 +21,8 @@ end
---@param v2 T
---@return T
misc.merge = function(v1, v2)
local merge1 = type(v1) == "table" and not vim.tbl_islist(v1)
local merge2 = type(v2) == "table" and not vim.tbl_islist(v1)
local merge1 = type(v1) == "table" and (not vim.tbl_islist(v1) or vim.tbl_isempty(v1))
local merge2 = type(v2) == "table" and (not vim.tbl_islist(v1) or vim.tbl_isempty(v1))
if merge1 and merge2 then
local new_tbl = {}
for k, v in pairs(v2) do