@@ -26,6 +26,18 @@ return function (uri, callback)
2626 local className = def .class [1 ]
2727 if not sortedDefs [className ] then
2828 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
2941 end
3042 local samedefs = sortedDefs [className ]
3143 samedefs [# samedefs + 1 ] = def
@@ -41,8 +53,8 @@ return function (uri, callback)
4153 for className , samedefs in pairs (sortedDefs ) do
4254 local missedKeys = {}
4355 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
4658 goto continue
4759 end
4860
@@ -78,6 +90,12 @@ return function (uri, callback)
7890 end
7991 end
8092 :: 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
8199 end
82100
83101 if # missedKeys == 0 then
0 commit comments