diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/diagnostics/init.lua | 59 |
1 files changed, 57 insertions, 2 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index a46a6dd7..1d8c4018 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -4,9 +4,10 @@ local config = require 'config' local util = require 'utility' local catch = require 'catch' -config.get 'Lua.diagnostics.neededFileStatus'['deprecated'] = 'Any' -config.get 'Lua.diagnostics.neededFileStatus'['type-check'] = 'Any' +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) @@ -1388,3 +1389,57 @@ function F() f() end ]] + +TEST [[ +---@param f async fun() +function CB(f) + <!f!>() +end +]] + +TEST [[ +local cb + +cb(function () ---@async + return nil +end) +]] + +TEST [[ +---@param f async fun() +function CB(f) + return f +end + +CB(function () ---@async + return nil +end) +]] + +TEST [[ +function CB(f) + return f +end + +<!CB!>(function () ---@async + return nil +end) +]] + +TEST [[ +---@type fun(f: async fun()) +local cb + +cb(function () ---@async + return nil +end) +]] + +TEST [[ +---@type fun(f: fun()) +local cb + +<!cb!>(function () ---@async + return nil +end) +]] |