diff options
-rw-r--r-- | script/vm/compiler.lua | 10 | ||||
-rw-r--r-- | test/definition/luadoc.lua | 22 |
2 files changed, 32 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index 05057e68..708b4e12 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -214,6 +214,16 @@ function vm.getClassFields(suri, node, key, pushResult) pushResult(field) end end) + if src.value and src.value.type == 'table' then + searchFieldSwitch('table', suri, src.value, key, function (field) + local fieldKey = guide.getKeyName(field) + if not searchedFields[fieldKey] + and guide.isSet(field) then + hasFounded[fieldKey] = true + pushResult(field) + end + end) + end end end -- look into extends(if field not found) diff --git a/test/definition/luadoc.lua b/test/definition/luadoc.lua index 97b12b85..d7ac9a5b 100644 --- a/test/definition/luadoc.lua +++ b/test/definition/luadoc.lua @@ -859,3 +859,25 @@ end <?t?> ]] + +TEST [[ +---@class A +local t = { + <!x!> = nil, +} + +---@type A +local f +f.<?x?> +]] + +TEST [[ +---@class A +G = { + <!x!> = nil, +} + +---@type A +local f +f.<?x?> +]] |