Skip to content

Commit 91ae26b

Browse files
committed
recover mark before return
fix #2004
1 parent b862736 commit 91ae26b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
## 3.6.18
44
* `FIX` [#1943]
55
* `FIX` [#1996]
6+
* `FIX` [#2004]
67
* `FIX` [#2013]
78

89
[#1943]: https://github.com/LuaLS/lua-language-server/issues/1943
910
[#1996]: https://github.com/LuaLS/lua-language-server/issues/1996
11+
[#2004]: https://github.com/LuaLS/lua-language-server/issues/2004
1012
[#2013]: https://github.com/LuaLS/lua-language-server/issues/2013
1113

1214
## 3.6.17

script/vm/type.lua

+1
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ function vm.isSubType(uri, child, parent, mark, errs)
466466
if ext.type == 'doc.extends.name'
467467
and (not isBasicType or guide.isBasicType(ext[1]))
468468
and vm.isSubType(uri, ext[1], parent, mark, errs) == true then
469+
mark[childName] = nil
469470
return true
470471
end
471472
end

test/diagnostics/type-check.lua

+17
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,23 @@ local arr2 = {
12381238
}
12391239
]]
12401240

1241+
TEST [[
1242+
---@class A
1243+
1244+
---@class B : A
1245+
1246+
---@class C : B
1247+
1248+
---@class D : B
1249+
1250+
---@param x A
1251+
local function func(x) end
1252+
1253+
---@type C|D
1254+
local var
1255+
func(var)
1256+
]]
1257+
12411258
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
12421259
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
12431260
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')

0 commit comments

Comments
 (0)