summaryrefslogtreecommitdiff
path: root/test/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-08 16:44:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-08 16:44:04 +0800
commit96946f4022a45519fa4e512c652d322cf8232a73 (patch)
treeeb458535c95d461c4ca522a1d757762cbbff9970 /test/diagnostics
parent8356a0494c0ec696b7017406e1c06b4277f6acbd (diff)
downloadlua-language-server-96946f4022a45519fa4e512c652d322cf8232a73.zip
yieldable check linked
Diffstat (limited to 'test/diagnostics')
-rw-r--r--test/diagnostics/init.lua59
1 files changed, 57 insertions, 2 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index 96e9e16d..e8e24141 100644
--- a/test/diagnostics/init.lua
+++ b/test/diagnostics/init.lua
@@ -7,7 +7,6 @@ local catch = require 'catch'
config.get 'Lua.diagnostics.neededFileStatus'['deprecated'] = 'Any'
config.get 'Lua.diagnostics.neededFileStatus'['type-check'] = 'Any'
config.get 'Lua.diagnostics.neededFileStatus'['await-in-sync'] = 'Any'
-config.get 'Lua.diagnostics.neededFileStatus'['not-yieldable'] = 'Any'
rawset(_G, 'TEST', true)
@@ -1419,7 +1418,6 @@ end
<!f()!>
]]
-
TEST [[
---@nodiscard
local function f()
@@ -1428,3 +1426,60 @@ end
X = f()
]]
+
+config.get 'Lua.diagnostics.neededFileStatus'['not-yieldable'] = 'Any'
+TEST [[
+local function f(cb)
+ return cb
+end
+
+---@async
+local function af()
+ return nil
+end
+
+f(<!af!>)
+]]
+
+TEST [[
+---@param cb async fun()
+local function f(cb)
+ return cb
+end
+
+---@async
+local function af()
+ return nil
+end
+
+f(af)
+]]
+
+TEST [[
+local function f(cb)
+ cb()
+end
+
+local function af()
+ <!f!>(function () ---@async
+ return nil
+ end)
+end
+
+return af
+]]
+
+TEST [[
+local function f(cb)
+ cb()
+end
+
+---@async
+local function af()
+ f(function () ---@async
+ return nil
+ end)
+end
+
+return af
+]]