-
-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve the missing-fields logic to be able to correctly handle classes defined several times #2770
improve the missing-fields logic to be able to correctly handle classes defined several times #2770
Conversation
…tent-behavior-(missing-fields)
local myKeys = {} | ||
for _, field in ipairs(src) do | ||
local key = vm.getKeyName(field) | ||
local key = vm.getKeyName(field) or field.tindex | ||
if key then | ||
myKeys[key] = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The computation of myKeys
seems independent with the current nested forloop. It only depends on src
, which is a function argument in the callback.
I suppose this can be optimized to execute only once using lazy initialization 😄
- first define
local myKeys
outside of current nested forloop - then inside the loop, only compute it
if myKeys == nil
local myKeys
for _, samedefs in pairs(sortedDefs) do
...
for _, def in ipairs(samedefs) do
...
-- build myKeys lookup table once
if myKeys == nil then
myKeys = {}
for _, field in ipairs(src) do
-- same logic
end
end
Co-authored-by: Tom Lau <[email protected]>
Co-authored-by: Tom Lau <[email protected]>
The diagnostic for this looks wrong to me. I'm not sure what the correct diagnostic should be, maybe it should be |
What I can do is only list the Classes that include all the specified fields. |
Please resolve the conflict. |
I think that would make more sense (if there is such a class) |
Thank you! |
linked to #2769.
this PR allows:
better display of missing fields
detects missing index fields
support class unions