diff options
-rw-r--r-- | script-beta/parser/guide.lua | 25 | ||||
-rw-r--r-- | script-beta/vm/getClass.lua | 2 | ||||
-rw-r--r-- | test-beta/hover/init.lua | 14 |
3 files changed, 28 insertions, 13 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 9939dce6..8324cfd0 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2575,11 +2575,12 @@ function m.viewInferType(infers) local hasDoc for i = 1, #infers do local infer = infers[i] - if infer.source.type == 'doc.class' - or infer.source.type == 'doc.class.name' - or infer.source.type == 'doc.type.name' - or infer.source.type == 'doc.type.array' - or infer.source.type == 'doc.type.generic' then + local src = infer.source + if src.type == 'doc.class' + or src.type == 'doc.class.name' + or src.type == 'doc.type.name' + or src.type == 'doc.type.array' + or src.type == 'doc.type.generic' then if infer.type ~= 'any' then hasDoc = true break @@ -2589,12 +2590,14 @@ function m.viewInferType(infers) if hasDoc then for i = 1, #infers do local infer = infers[i] - if infer.source.type == 'doc.class' - or infer.source.type == 'doc.class.name' - or infer.source.type == 'doc.type.name' - or infer.source.type == 'doc.type.array' - or infer.source.type == 'doc.type.generic' - or infer.source.type == 'doc.type.enum' then + local src = infer.source + if src.type == 'doc.class' + or src.type == 'doc.class.name' + or src.type == 'doc.type.name' + or src.type == 'doc.type.array' + or src.type == 'doc.type.generic' + or src.type == 'doc.type.enum' + or src.type == 'doc.resume' then local tp = infer.type or 'any' if not mark[tp] then types[#types+1] = tp diff --git a/script-beta/vm/getClass.lua b/script-beta/vm/getClass.lua index bd7f6f7c..1623090c 100644 --- a/script-beta/vm/getClass.lua +++ b/script-beta/vm/getClass.lua @@ -2,7 +2,7 @@ local vm = require 'vm.vm' local guide = require 'parser.guide' local function lookUpDocClass(source) - local infers = vm.getInfers(source) + local infers = vm.getInfers(source, 'deep') for _, infer in ipairs(infers) do if infer.source.type == 'doc.class' or infer.source.type == 'doc.type' then diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua index 6b316919..fb2bbf95 100644 --- a/test-beta/hover/init.lua +++ b/test-beta/hover/init.lua @@ -1346,7 +1346,7 @@ global t: c { TEST [[ ---@class c -t = {} +local t = {} ---@overload fun() function t.<?f?>() end @@ -1357,6 +1357,18 @@ function t.<?f?>() end ]] TEST [[ +---@class c +t = {} + +---@overload fun() +function t.<?f?>() end +]] +[[ +(2 个定义,1 个原型) +(2) function t.f() +]] + +TEST [[ ---@class C ---@field field any |