From c979f901d19440c6f2cdc899ea38e7c9dc204405 Mon Sep 17 00:00:00 2001 From: sumneko Date: Fri, 11 Mar 2022 02:12:50 +0800 Subject: update --- script/vm/infer.lua | 5 +++++ test/type_inference/init.lua | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/script/vm/infer.lua b/script/vm/infer.lua index d5ab2d46..f393306c 100644 --- a/script/vm/infer.lua +++ b/script/vm/infer.lua @@ -49,6 +49,7 @@ local viewNodeMap = util.switch() end) : case 'doc.type.name' : call(function (source, options) + options['hasClass'] = true if source.signs then local buf = {} for i, sign in ipairs(source.signs) do @@ -64,6 +65,10 @@ local viewNodeMap = util.switch() options['hasClass'] = true return m.viewType(source.node) .. '[]' end) + : case 'doc.type.table' + : call(function (source, options) + options['hasTable'] = true + end) : case 'doc.type.enum' : call(function (source, options) return ('%q'):format(source[1]) diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 07a3e2f0..188ca06b 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -481,6 +481,11 @@ TEST 'fun(a: string, b: any, c?: boolean, ...: any):c, d?, ...' [[ local ]] +TEST 'table' [[ +---@type { [string]: string } +local +]] + TEST 'table' [[ ---@class string ---@class number -- cgit v1.2.3