From ffa782066c2e02a068171963aded4bb300c25663 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 25 Sep 2026 17:07:21 +0100 Subject: fix(lua): enable assignment type checking in runtime code Enable EmmyLua's assign-type-mismatch diagnostic after correcting the runtime annotations and assignments it flags. Correct option, tuple, and return types, and use separate locals when a value changes representation. Add guards and narrow casts where needed so the runtime passes the stricter check. Regenerate the affected docs. AI-assisted --- runtime/lua/vim/keymap.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/lua/vim/keymap.lua') diff --git a/runtime/lua/vim/keymap.lua b/runtime/lua/vim/keymap.lua index 061d3340fe..2805bbe8dd 100644 --- a/runtime/lua/vim/keymap.lua +++ b/runtime/lua/vim/keymap.lua @@ -71,10 +71,10 @@ function keymap.set(modes, lhs, rhs, opts) opts = vim.deepcopy(opts or {}, true) - ---@cast modes string[] modes = type(modes) == 'string' and { modes } or modes - ---@cast lhs string[] + ---@cast modes string[] lhs = type(lhs) == 'string' and { lhs } or lhs + ---@cast lhs string[] if opts.expr and opts.replace_keycodes ~= false then opts.replace_keycodes = true @@ -143,10 +143,10 @@ function keymap.del(modes, lhs, opts) opts = opts or {} - --- @cast modes string[] modes = type(modes) == 'string' and { modes } or modes - ---@cast lhs string[] + --- @cast modes string[] lhs = type(lhs) == 'string' and { lhs } or lhs + ---@cast lhs string[] local buf = opts.buf --- @cast opts +{buffer?:integer|boolean} -- cgit