From c43c745a14dced87a23227d7be4f1c33d4455193 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 9 Aug 2023 11:06:13 +0200 Subject: fix(lua): improve annotations for stricter luals diagnostics (#24609) Problem: luals returns stricter diagnostics with bundled luarc.json Solution: Improve some function and type annotations: * use recognized uv.* types * disable diagnostic for global `vim` in shared.lua * docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type) * add type alias for lpeg pattern * fix return annotation for `vim.secure.trust` * rename local Range object in vim.version (shadows `Range` in vim.treesitter) * fix some "missing fields" warnings * add missing required fields for test functions in eval.lua * rename lsp meta files for consistency --- test/unit/set.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/unit/set.lua b/test/unit/set.lua index 91b7e2dd70..7c30be32aa 100644 --- a/test/unit/set.lua +++ b/test/unit/set.lua @@ -12,7 +12,7 @@ local Set = {} --- @param items? string[] function Set:new(items) - local obj = {} --- @ type Set + local obj = {} --- @type Set setmetatable(obj, self) self.__index = self @@ -33,10 +33,7 @@ end --- @return Set function Set:copy() - local obj = {} --- @ type Set - obj.nelem = self.nelem - obj.tbl = {} - obj.items = {} + local obj = {nelem = self.nelem, tbl = {}, items = {}} --- @type Set for k, v in pairs(self.tbl) do obj.tbl[k] = v end -- cgit