File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -374,9 +374,18 @@ local compilerGlobalSwitch = util.switch()
374
374
end
375
375
source ._enums = {}
376
376
for _ , field in ipairs (tbl ) do
377
- if field .type == ' tablefield'
378
- or field .type == ' tableindex' then
377
+ if field .type == ' tablefield' then
379
378
source ._enums [# source ._enums + 1 ] = field
379
+ local subType = vm .declareGlobal (' type' , name .. ' .' .. field .field [1 ], uri )
380
+ subType :addSet (uri , field )
381
+ field ._globalNode = subType
382
+ elseif field .type == ' tableindex' then
383
+ source ._enums [# source ._enums + 1 ] = field
384
+ if field .index .type == ' string' then
385
+ local subType = vm .declareGlobal (' type' , name .. ' .' .. field .index [1 ], uri )
386
+ subType :addSet (uri , field )
387
+ field ._globalNode = subType
388
+ end
380
389
end
381
390
end
382
391
end )
Original file line number Diff line number Diff line change @@ -3947,3 +3947,18 @@ end
3947
3947
3948
3948
local <?x?> = f(true)
3949
3949
]]
3950
+
3951
+ TEST ' boolean' [[
3952
+ ---@enum A
3953
+ local e = {
3954
+ x = 1,
3955
+ y = 2,
3956
+ }
3957
+
3958
+ ---@param p A
3959
+ ---@overload fun(P: A.x): boolean
3960
+ ---@overload fun(p: A.y): number
3961
+ local function f(p) end
3962
+
3963
+ local <?r?> = f(e.x)
3964
+ ]]
You can’t perform that action at this time.
0 commit comments