summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/parser/guide.lua1
-rw-r--r--test/type_inference/init.lua40
2 files changed, 28 insertions, 13 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index c72cd60c..c657ef4b 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -102,6 +102,7 @@ m.childMap = {
['doc.type.table'] = {'node', 'key', 'value', 'comment'},
['doc.type.function'] = {'#args', '#returns', 'comment'},
['doc.type.typeliteral'] = {'node'},
+ ['doc.type.arg'] = {'extends'},
['doc.overload'] = {'overload', 'comment'},
['doc.see'] = {'name', 'field'},
}
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index fea3c1bd..4eee872f 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -427,16 +427,30 @@ local t
local k, <?v?> = next(t)
]]
---TEST 'string' [[
------@type table<string, boolean>
---local t
---for <?k?>, v in pairs(t) do
---end
---]]
---
---TEST 'boolean' [[
------@type table<string, boolean>
---local t
---for k, <?v?> in pairs(t) do
---end
---]]
+TEST 'string' [[
+---@generic T: table, K, V
+---@param t T
+---@return fun(table: table<K, V>, index: K):K, V
+---@return T
+---@return nil
+function pairs(t) end
+
+---@type table<string, boolean>
+local t
+for <?k?>, v in pairs(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
+function pairs(t) end
+
+---@type table<string, boolean>
+local t
+for k, <?v?> in pairs(t) do
+end
+]]