summaryrefslogtreecommitdiff
path: root/test/diagnostics/not-yieldable.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/diagnostics/not-yieldable.lua')
-rw-r--r--test/diagnostics/not-yieldable.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/diagnostics/not-yieldable.lua b/test/diagnostics/not-yieldable.lua
new file mode 100644
index 00000000..81e972ee
--- /dev/null
+++ b/test/diagnostics/not-yieldable.lua
@@ -0,0 +1,48 @@
+TEST [[
+---@param cb fun()
+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
+
+---@async
+local function af()
+ f(function () ---@async
+ return nil
+ end)
+end
+
+return af
+]]
+
+TEST [[
+local _ = type(function () ---@async
+ return nil
+end)
+]]