@@ -25,23 +25,50 @@ config.set(nil, 'Lua.diagnostics.neededFileStatus',
2525 [' incomplete-signature-doc' ] = ' Any!' -- override groupFileStatus
2626})
2727
28- -- check global functions
28+ -- -------------------------------------
29+ -- about the structure of these test cases
30+ --
31+ -- the following test cases are grouped by the number of parameters and return values of the functions
32+ -- so first global functions with:
33+ -- no parameter and return value (FG), one parameter (FGP), two parameters (FGPP),
34+ -- one return value (FGR), two return values (FGRR) and parameter and return value (FGPR)
35+ -- after that, these groups are also done for local functions (FL, FLP, ...)
36+ --
37+ -- in these groups, different versions of documentation are tested:
38+ -- no comment, simple comment, @async annotation (which is no signature doc),
39+ -- incomplete signature doc (only part of the necessary @param or @return annotations, if possible) - the only cases that should generating warnings
40+ -- and complete signature docs (all necessary @param and @return annotations)
41+ -- -------------------------------------
42+
43+ -- global functions no parameter, no return value
44+ -- no incomplete signature docs possible
2945TEST [[
3046function FG0()
3147end
3248
3349---comment
3450function FG1()
3551end
52+
53+ ---@async
54+ function FG1_()
55+ end
3656]]
3757
58+ -- global functions with single parameter, no return value
59+ -- no incomplete signature docs possible
3860TEST [[
3961function FGP0(p)
4062 print(p)
4163end
4264
4365---comment
44- function FGP1(<!p!>)
66+ function FGP1(p)
67+ print(p)
68+ end
69+
70+ ---@async
71+ function FGP1_(p)
4572 print(p)
4673end
4774
@@ -52,13 +79,20 @@ function FGP2(p)
5279end
5380]]
5481
82+ -- global functions with two parameters, no return value
83+ -- incomplete signature docs when exactly one of the parameters is documented
5584TEST [[
5685function FGPP0(p0, p1)
5786 print(p0, p1)
5887end
5988
6089---comment
61- function FGPP1(<!p0!>, <!p1!>)
90+ function FGPP1(p0, p1)
91+ print(p0, p1)
92+ end
93+
94+ ---@async
95+ function FGPP1_(p0, p1)
6296 print(p0, p1)
6397end
6498
@@ -68,6 +102,12 @@ function FGPP2(p0, <!p1!>)
68102 print(p0, p1)
69103end
70104
105+ ---comment
106+ ---@param p1 any
107+ function FGPP2_(<!p0!>, p1)
108+ print(p0, p1)
109+ end
110+
71111---comment
72112---@param p0 any
73113---@param p1 any
@@ -76,14 +116,21 @@ function FGPP3(p0, p1)
76116end
77117]]
78118
119+ -- global functions with no parameter, single return value
120+ -- no incomplete signature docs possible
79121TEST [[
80122function FGR0()
81123 return 0
82124end
83125
84126---comment
85127function FGR1()
86- return <!0!>
128+ return 0
129+ end
130+
131+ ---@async
132+ function FGR1_()
133+ return 0
87134end
88135
89136---comment
@@ -93,14 +140,21 @@ function FGR2()
93140end
94141]]
95142
143+ -- global functions with no parameter, two return values
144+ -- incomplete signature docs when exactly one of the return values is documented
96145TEST [[
97146function FGRR0()
98147 return 0, 1
99148end
100149
101150---comment
102151function FGRR1()
103- return <!0!>, <!1!>
152+ return 0, 1
153+ end
154+
155+ ---@async
156+ function FGRR1_()
157+ return 0, 1
104158end
105159
106160---comment
@@ -117,16 +171,24 @@ function FGRR3()
117171end
118172]]
119173
174+ -- global functions with one parameter, one return value
175+ -- incomplete signature docs when exactly one of parameter or return value is documented
120176TEST [[
121177function FGPR0(p)
122178 print(p)
123179 return 0
124180end
125181
126182---comment
127- function FGPR1(<!p!> )
183+ function FGPR1(p )
128184 print(p)
129- return <!0!>
185+ return 0
186+ end
187+
188+ ---@async
189+ function FGPR1_(p)
190+ print(p)
191+ return 0
130192end
131193
132194---comment
@@ -152,8 +214,8 @@ function FGPR4(p)
152214end
153215]]
154216
155- -- check local functions
156-
217+ -- local functions with no parameter, no return value
218+ -- no incomplete signature docs possible
157219TEST [[
158220local function FL0()
159221end
@@ -165,8 +227,13 @@ local function FL1()
165227end
166228
167229FL1()
230+
231+ ---@async
232+ local function FL1_()
168233]]
169234
235+ -- local functions with single parameter, no return value
236+ -- no incomplete signature docs possible
170237TEST [[
171238local function FLP0(p)
172239 print(p)
@@ -175,12 +242,17 @@ end
175242FLP0(0)
176243
177244---comment
178- local function FLP1(<!p!> )
245+ local function FLP1(p )
179246 print(p)
180247end
181248
182249FLP1(0)
183250
251+ ---@async
252+ local function FLP1_(p)
253+ print(p)
254+ end
255+
184256---comment
185257---@param p any
186258local function FLP2(p)
190262FLP2(0)
191263]]
192264
265+ -- local functions with two parameters, no return value
266+ -- incomplete signature docs when exactly one of the parameters is documented
193267TEST [[
194268local function FLPP0(p0, p1)
195269 print(p0, p1)
@@ -198,12 +272,17 @@ end
198272FLPP0(0, 1)
199273
200274---comment
201- local function FLPP1(<!p0!>, <!p1!> )
275+ local function FLPP1(p0, p1 )
202276 print(p0, p1)
203277end
204278
205279FLPP1(0, 1)
206280
281+ ---@async
282+ local function FLPP1_(p0, p1)
283+ print(p0, p1)
284+ end
285+
207286---comment
208287---@param p0 any
209288local function FLPP2(p0, <!p1!>)
222301FLPP3(0, 1)
223302]]
224303
304+ -- local functions with no parameter, single return value
305+ -- no incomplete signature docs possible
225306TEST [[
226307local function FLR0()
227308 return 0
@@ -231,7 +312,12 @@ local vr0 = FLR0()
231312
232313---comment
233314local function FLR1()
234- return <!0!>
315+ return 0
316+ end
317+
318+ ---@async
319+ local function FLR1_()
320+ return 0
235321end
236322
237323local vr1 = FLR1()
245331local vr2 = FLR2()
246332]]
247333
334+ -- local functions with no parameter, two return values
335+ -- incomplete signature docs when exactly one of the return values is documented
248336TEST [[
249337local function FLRR0()
250338 return 0, 1
@@ -254,11 +342,16 @@ local vrr0, _ = FLRR0()
254342
255343---comment
256344local function FLRR1()
257- return <!0!>, <!1!>
345+ return 0, 1
258346end
259347
260348local vrr1, _ = FLRR1()
261349
350+ ---@async
351+ local function FLRR1_()
352+ return 0, 1
353+ end
354+
262355---comment
263356---@return integer
264357local function FLRR2()
277370local vrr3, _ = FLRR3()
278371]]
279372
373+ -- local functions with one parameter, one return value
374+ -- incomplete signature docs when exactly one of parameter or return value is documented
280375TEST [[
281376local function FLPR0(p)
282377 print(p)
286381local vpr0 = FLPR0(0)
287382
288383---comment
289- local function FLPR1(<!p!> )
384+ local function FLPR1(p )
290385 print(p)
291- return <!0!>
386+ return 0
387+ end
388+
389+ ---@async
390+ local function FLPR1_(p)
391+ print(p)
392+ return 0
292393end
293394
294395local vpr1 = FLPR1(0)
0 commit comments