diff options
-rw-r--r-- | meta/template/debug.lua | 7 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 27 | ||||
-rw-r--r-- | test-beta/hover/init.lua | 13 |
3 files changed, 41 insertions, 6 deletions
diff --git a/meta/template/debug.lua b/meta/template/debug.lua index a8c7f2df..8db01634 100644 --- a/meta/template/debug.lua +++ b/meta/template/debug.lua @@ -12,3 +12,10 @@ function debug.getfenv(o) end ---@return string mask ---@return integer count function debug.gethook(co) end + +---@alias infowhat '"nSltufL"' +---@alias finfo +---| '""' + +---@overload fun(f: integer|function, what: infowhat?):finfo +function debug.getinfo1(thread, f, what) end diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 93961733..ca1716e0 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -2701,14 +2701,29 @@ function m.inferCheckUpDoc(status, source) if parent then if parent.type == 'local' or parent.type == 'setlocal' - or parent.type == 'setglobal' - or parent.type == 'setfield' - or parent.type == 'setmethod' - or parent.type == 'setindex' - or parent.type == 'tablefield' - or parent.type == 'tableindex' then + or parent.type == 'setglobal' then source = parent end + if parent.type == 'setfield' + or parent.type == 'tablefield' then + if parent.field == source + or parent.value == source then + source = parent + end + end + if parent.type == 'setmethod' then + if parent.method == source + or parent.value == source then + source = parent + end + end + if parent.type == 'setindex' + or parent.type == 'tableindex' then + if parent.index == source + or parent.value == source then + source = parent + end + end end local binds = source.bindDocs if not binds then diff --git a/test-beta/hover/init.lua b/test-beta/hover/init.lua index 55ce9845..912807ac 100644 --- a/test-beta/hover/init.lua +++ b/test-beta/hover/init.lua @@ -1324,3 +1324,16 @@ local <?t?> [[ local t: string|'enum1'|'enum2' ]] + +TEST [[ +---@class c +t = {} + +---@overload fun() +function <?t?>.f() end +]] +[[ +global t: c { + f: function, +} +]] |