summaryrefslogtreecommitdiff
path: root/test/diagnostics/await-in-sync.lua
blob: 323c1113756d6b24869830b846ea06a08726c7f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
TEST [[
function F()
    <!coroutine.yield!>()
end
]]

TEST [[
---@async
function F()
    coroutine.yield()
end
]]

TEST [[
---@type async fun()
local f

function F()
    <!f!>()
end
]]

TEST [[
---@type async fun()
local f

---@async
function F()
    f()
end
]]

TEST [[
local function f(cb)
    cb()
end

return function()
    <!f>(function () ---@async
        return nil
    end)
end
]]

TEST [[
local function f(cb)
    pcall(cb)
end

return function()
    <!f!>(function () ---@async
        return nil
    end)
end
]]

TEST [[
---@param c any
local function f(c)
    return c
end

return function ()
    f(function () ---@async
        return nil
    end)
end
]]

TEST [[
---@param ... any
local function f(...)
    return ...
end

return function ()
    f(function () ---@async
        return nil
    end)
end
]]

TEST [[
---@vararg any
local function f(...)
    return ...
end

return function ()
    f(function () ---@async
        return nil
    end)
end
]]

TEST [[
local function f(...)
    return ...
end

return function ()
    f(function () ---@async
        return nil
    end)
end
]]

TEST [[
local function f(...)
    return ...
end

return function ()
    f(function () ---@async
        return nil
    end)
end
]]

TEST [[
local function f(cb)
    cb()
end

local function af()
    <!f!>(function () ---@async
        return nil
    end)
end

return af
]]