diff options
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | script/vm/type.lua | 1 | ||||
-rw-r--r-- | test/diagnostics/type-check.lua | 17 |
3 files changed, 20 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index 59a3ca68..4f5b7b73 100644 --- a/changelog.md +++ b/changelog.md @@ -3,10 +3,12 @@ ## 3.6.18 * `FIX` [#1943] * `FIX` [#1996] +* `FIX` [#2004] * `FIX` [#2013] [#1943]: https://github.com/LuaLS/lua-language-server/issues/1943 [#1996]: https://github.com/LuaLS/lua-language-server/issues/1996 +[#2004]: https://github.com/LuaLS/lua-language-server/issues/2004 [#2013]: https://github.com/LuaLS/lua-language-server/issues/2013 ## 3.6.17 diff --git a/script/vm/type.lua b/script/vm/type.lua index 756926ba..8382eb86 100644 --- a/script/vm/type.lua +++ b/script/vm/type.lua @@ -466,6 +466,7 @@ function vm.isSubType(uri, child, parent, mark, errs) if ext.type == 'doc.extends.name' and (not isBasicType or guide.isBasicType(ext[1])) and vm.isSubType(uri, ext[1], parent, mark, errs) == true then + mark[childName] = nil return true end end diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index 4abe5855..18e7190d 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -1238,6 +1238,23 @@ local arr2 = { } ]] +TEST [[ +---@class A + +---@class B : A + +---@class C : B + +---@class D : B + +---@param x A +local function func(x) end + +---@type C|D +local var +func(var) +]] + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'unused-function') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') |