@@ -51,6 +51,97 @@ local t = {
5151}
5252]]
5353
54+ TEST [[
55+ ---@diagnostic disable: unused-local
56+ ---@class A
57+ ---@field x number
58+ ---@field y? number
59+ ---@field z number
60+ local A = {}
61+
62+ function A:fun()
63+ end
64+
65+ ---@type A
66+ local t = {
67+ x = 1,
68+ y = 2,
69+ z = 3,
70+ }
71+ ]]
72+
73+ TEST [[
74+ ---@diagnostic disable: unused-local
75+
76+ ---@class Parent
77+ ---@field a number
78+ local Parent = {}
79+
80+ function Parent:fun2()
81+ end
82+
83+ ---@class A : Parent
84+ ---@field x number
85+ ---@field y? number
86+ ---@field z number
87+ local A = {}
88+
89+ function A:fun()
90+ end
91+
92+ ---@type A
93+ local t = <!{
94+ x = 1,
95+ y = 2,
96+ }!>
97+ ]]
98+
99+ TEST [[
100+ ---@diagnostic disable: unused-local
101+
102+ ---@class Parent
103+ ---@field a number
104+ local Parent = {}
105+
106+ function Parent:fun2()
107+ end
108+
109+ ---@class A : Parent
110+ ---@field x number
111+ ---@field y? number
112+ ---@field z number
113+ local A = {}
114+
115+ function A:fun()
116+ end
117+
118+ ---@type A
119+ local t = {
120+ x = 1,
121+ y = 2,
122+ z = 3,
123+ a = 1,
124+ }
125+ ]]
126+
127+ TEST [[
128+ ---@diagnostic disable: unused-local
129+ ---@class A
130+ ---@field x number
131+ ---@field y? number
132+ ---@field z number
133+ local A = {}
134+
135+ function A:fun()
136+ end
137+
138+ ---@type A
139+ local t = <!{
140+ x = 1,
141+ y = 2,
142+ }!>
143+ ]]
144+
54145TEST [[
55146---@diagnostic disable: unused-local
56147---@class A
@@ -336,7 +427,7 @@ local x = <!{
336427}!>
337428]]
338429
339- TEST [[
430+ TEST [[
340431---@class A
341432---@field [1] string
342433---@field x number
@@ -345,7 +436,7 @@ TEST[[
345436local t = {x = 1, ""}
346437]]
347438
348- TEST [[
439+ TEST [[
349440---@class A
350441---@field [1] string
351442---@field x number
@@ -356,7 +447,7 @@ local t = <!{x = 1}!>
356447
357448-- Inheritance
358449
359- TEST [[
450+ TEST [[
360451---@class A
361452---@field x number
362453
@@ -366,7 +457,7 @@ TEST[[
366457local t = <!{}!>
367458]]
368459
369- TEST [[
460+ TEST [[
370461---@class A
371462---@field x number
372463---@field y number
@@ -377,7 +468,7 @@ TEST[[
377468local t = <!{y = 1}!>
378469]]
379470
380- TEST [[
471+ TEST [[
381472---@class A
382473---@field x number
383474
@@ -390,7 +481,7 @@ local t = <!{y = 1}!>
390481
391482-- Inheritance + optional
392483
393- TEST [[
484+ TEST [[
394485---@class A
395486---@field x? number
396487
@@ -400,7 +491,7 @@ TEST[[
400491local t = {}
401492]]
402493
403- TEST [[
494+ TEST [[
404495---@class A
405496---@field x? number
406497---@field y number
@@ -411,7 +502,7 @@ TEST[[
411502local t = {y = 1}
412503]]
413504
414- TEST [[
505+ TEST [[
415506---@class A
416507---@field x? number
417508
@@ -424,7 +515,7 @@ local t = {y = 1}
424515
425516-- Inheritance + function call
426517
427- TEST [[
518+ TEST [[
428519---@class A
429520---@field x number
430521
@@ -436,7 +527,7 @@ local function f(b) end
436527f <!{}!>
437528]]
438529
439- TEST [[
530+ TEST [[
440531---@class A
441532---@field x number
442533---@field y number
@@ -449,7 +540,7 @@ local function f(b) end
449540f <!{y = 1}!>
450541]]
451542
452- TEST [[
543+ TEST [[
453544---@class A
454545---@field x number
455546
@@ -464,7 +555,7 @@ f <!{y = 1}!>
464555
465556-- partial class
466557
467- TEST [[
558+ TEST [[
468559---@class A
469560---@field x number
470561
@@ -474,7 +565,7 @@ TEST[[
474565local t = {}
475566]]
476567
477- TEST [[
568+ TEST [[
478569---@class A
479570---@field x number
480571
@@ -485,7 +576,7 @@ TEST[[
485576local t = <!{}!>
486577]]
487578
488- TEST [[
579+ TEST [[
489580---@class A
490581---@field x number
491582
0 commit comments