@@ -26,6 +26,18 @@ return function (uri, callback)
26
26
local className = def .class [1 ]
27
27
if not sortedDefs [className ] then
28
28
sortedDefs [className ] = {}
29
+ -- check if this class is a `partial` class
30
+ -- a partial class will not check missing inherited fields
31
+ local class = vm .getGlobal (' type' , className )
32
+ --- @cast class - nil
33
+ for _ , set in ipairs (class :getSets (uri )) do
34
+ if set .type == ' doc.class'
35
+ and vm .docHasAttr (set , ' partial' )
36
+ then
37
+ sortedDefs [className ].isPartial = true
38
+ break
39
+ end
40
+ end
29
41
end
30
42
local samedefs = sortedDefs [className ]
31
43
samedefs [# samedefs + 1 ] = def
@@ -41,8 +53,8 @@ return function (uri, callback)
41
53
for className , samedefs in pairs (sortedDefs ) do
42
54
local missedKeys = {}
43
55
for _ , def in ipairs (samedefs ) do
44
- local fields = vm .getFields (def )
45
- if # fields == 0 then
56
+ local fields = samedefs . isPartial and def . fields or vm .getFields (def )
57
+ if not fields or # fields == 0 then
46
58
goto continue
47
59
end
48
60
@@ -78,6 +90,12 @@ return function (uri, callback)
78
90
end
79
91
end
80
92
:: continue::
93
+
94
+ if not samedefs .isPartial then
95
+ -- if not partial class, then all fields in this class have already been checked
96
+ -- because in the above uses `vm.getFields` to get all fields
97
+ break
98
+ end
81
99
end
82
100
83
101
if # missedKeys == 0 then
0 commit comments