From d7af8707026968887ea4ee3a4e6fa51fd4372033 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 24 Sep 2026 13:30:07 +0100 Subject: fix(lua): enable nil-safety diagnostics in runtime code Enable EmmyLua's need-check-nil diagnostic and resolve nullable values through more precise types, explicit invariants, and guards for missing runtime state. Keep analyzer-specific workarounds local and update the affected API documentation. Exclude the bundled re.lua from analysis so its nil-check warnings do not fail CI. AI-assisted --- runtime/lua/vim/_watch.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/_watch.lua') diff --git a/runtime/lua/vim/_watch.lua b/runtime/lua/vim/_watch.lua index bdb5882150..b3b9b99b96 100644 --- a/runtime/lua/vim/_watch.lua +++ b/runtime/lua/vim/_watch.lua @@ -65,7 +65,7 @@ M.FileChangeType = { --- @field subscribers table --- @field cancel? fun() ---- @type table>> +--- @type table<'watch'|'watchdirs'|'inotify', table>> local shared = { watch = {}, watchdirs = {}, inotify = {} } --- Counts backend watchers with outstanding subscriptions, excluding failed starts. @@ -238,7 +238,7 @@ local function subscribe(name, backend, path, opts, rules, subscriber) shared[name][path] = nil end - entry.cancel() + assert(entry.cancel)() end end end -- cgit