Skip to content

Commit de31a1a

Browse files
committed
test(diagnostics): add test suite for no-unknown-operations function calls
1 parent 46ebddf commit de31a1a

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

test/diagnostics/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ check 'unnecessary-assert'
110110
check 'newfield-call'
111111
check 'newline-call'
112112
check 'not-yieldable'
113+
check 'no-unknown-operations'
113114
check 'param-type-mismatch'
114115
check 'redefined-local'
115116
check 'redundant-parameter'
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
TEST [[
2+
local x = 5
3+
<!x()!>
4+
5+
---@overload fun(): string
6+
local x = 5
7+
x()
8+
9+
---@class x
10+
---@operator call(): string
11+
local x = {}
12+
x()
13+
]]
14+
15+
TEST [[
16+
---@type nil
17+
local x
18+
<!x()!>
19+
20+
---@overload fun(): string
21+
local x
22+
x()
23+
24+
---@class x
25+
---@operator call(): string
26+
local x
27+
x()
28+
]]
29+
30+
TEST [[
31+
---@type unknown
32+
local x
33+
x()
34+
]]
35+
36+
TEST [[
37+
local function f()
38+
end
39+
f()
40+
]]
41+
42+
TEST [[
43+
<!(0)()!>
44+
]]
45+
46+
TEST [[
47+
<!("")()!>
48+
]]
49+
50+
TEST [[
51+
(function() end)()
52+
]]

0 commit comments

Comments
 (0)