diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-03 10:52:43 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-03 10:52:43 +0800 |
commit | b9e9b9e32f7f7d34dfaa1707f073d0b5fa456fcc (patch) | |
tree | 76935701d8902fb60fa29a8c0e482e5737878e24 /test/type_inference | |
parent | 2e4d09302e175f7db61063caba29c688ff606c96 (diff) | |
download | lua-language-server-b9e9b9e32f7f7d34dfaa1707f073d0b5fa456fcc.zip |
#435 treat `V[]` as `table<integer, V>` in `pairs`
Diffstat (limited to 'test/type_inference')
-rw-r--r-- | test/type_inference/init.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua index 0dab932e..6ab57a06 100644 --- a/test/type_inference/init.lua +++ b/test/type_inference/init.lua @@ -563,6 +563,36 @@ for _, <?v?> in ipairs(t) do end ]] +TEST 'boolean' [[ +---@generic T: table, K, V +---@param t T +---@return fun(table: table<K, V>, index: K):K, V +---@return T +---@return nil +local function pairs(t) end + +---@type boolean[] +local t + +for k, <?v?> in pairs(t) do +end +]] + +TEST 'integer' [[ +---@generic T: table, K, V +---@param t T +---@return fun(table: table<K, V>, index: K):K, V +---@return T +---@return nil +local function pairs(t) end + +---@type boolean[] +local t + +for <?k?>, v in pairs(t) do +end +]] + TEST 'E' [[ ---@class A ---@class B: A |