Skip to content

Commit

Permalink
fix stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Aug 11, 2023
1 parent ce2b607 commit ed35008
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions script/vm/type.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ end
---@param errs? typecheck.err[]
---@return boolean?
local function checkChildEnum(childName, parent , uri, mark, errs)
if mark[childName] then
return
end
local childClass = vm.getGlobal('type', childName)
if not childClass then
return nil
Expand All @@ -157,11 +160,14 @@ local function checkChildEnum(childName, parent , uri, mark, errs)
if not enums then
return nil
end
mark[childName] = true
for _, enum in ipairs(enums) do
if not vm.isSubType(uri, vm.compileNode(enum), parent, mark ,errs) then
mark[childName] = nil
return false
end
end
mark[childName] = nil
return true
end

Expand Down
13 changes: 13 additions & 0 deletions test/hover/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2475,3 +2475,16 @@ local <?x?>
[[
local x: A
]]

TEST [[
---@type A
local <?f?>
---@enum A
local t = {
x = f,
}
]]
[[
local f: A
]]

0 comments on commit ed35008

Please sign in to comment.