diff options
-rw-r--r-- | script/parser/guide.lua | 8 | ||||
-rw-r--r-- | test/type_inference/init.lua | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 53849a52..d510837a 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -2494,6 +2494,10 @@ function m.pushResult(status, mode, ref, simple) or ref.type == 'doc.alias.name' or ref.type == 'doc.field' then results[#results+1] = ref + elseif ref.type == 'doc.type' then + if #ref.enums > 0 or #ref.resumes > 0 then + results[#results+1] = ref + end end if ref.parent and ref.parent.type == 'return' then if m.getParentFunction(ref) ~= m.getParentFunction(simple.node) then @@ -2537,6 +2541,10 @@ function m.pushResult(status, mode, ref, simple) or ref.type == 'doc.alias.name' or ref.type == 'doc.field' then results[#results+1] = ref + elseif ref.type == 'doc.type' then + if #ref.enums > 0 or #ref.resumes > 0 then + results[#results+1] = ref + end end if ref.parent and ref.parent.type == 'return' then results[#results+1] = ref diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 5760af26..ecdb17a8 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -369,3 +369,19 @@ TEST 'table' [[ local t = {} local <?v?> = setmetatable(t) ]] + +TEST [[CCC]] [[ +---@class CCC + +---@type table<string, CCC> +local t = {} + +print(t.<?a?>) +]] + +TEST '"aaa"|"bbb"' [[ +---@type table<string, '"aaa"'|'"bbb"'> +local t = {} + +print(t.<?a?>) +]] |