summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-26 15:30:53 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-26 15:30:53 +0800
commit2c688721092f1fe102514eed6a836ccfeb12a789 (patch)
tree90fcdee55dce2530e57534858b19893aba3fe486 /test
parentcbc8e42f84fdb8468d2f31797fc8a2d6344c53d4 (diff)
downloadlua-language-server-2c688721092f1fe102514eed6a836ccfeb12a789.zip
improve type_infer
Diffstat (limited to 'test')
-rw-r--r--test/type_inference/init.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 883385f8..28bdd0e9 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -436,6 +436,42 @@ local <?r?> = f(true)
]]
TEST 'string' [[
+---@generic K, V
+---@type fun(arg: table<K, V>):K, V
+local f
+
+---@type table<string, boolean>
+local t
+
+local <?k?>, v = f(t)
+]]
+
+TEST 'boolean' [[
+---@generic K, V
+---@type fun(arg: table<K, V>):K, V
+local f
+
+---@type table<string, boolean>
+local t
+
+local k, <?v?> = f(t)
+]]
+
+TEST 'function' [[
+---@return fun()
+local function f() end
+
+local <?r?> = f()
+]]
+
+TEST 'table<string, boolean>' [[
+---@return table<string, boolean>
+local function f() end
+
+local <?r?> = f()
+]]
+
+TEST 'string' [[
---@generic T: table, K, V
---@param t T
---@return fun(table: table<K, V>, index: K):K, V