-
-
Notifications
You must be signed in to change notification settings - Fork 394
Open
Labels
feat/diagnosticsRelated to the diagnostics featureRelated to the diagnostics feature
Description
Issue Description
Hi!
I have a code that looks something like this:
---@param t? table
function api.f(t)
t = type(t) == "table" and t or {}
t.x = t.x or {} --warning is raised but t can never be nil here because it is set to {} if it was but diagnostics fail to see that
--etc.
endNil checks are not required here because t should never be nil, the preceding lines redefines it as an empty table if it was nil or invalid so the reference should always exist when trying to check if x exists within the table.
I have seen similar reports but I'm not sure if this exact case has been reported or not. I couldn't find a match or I failed to recognize it.
Additional Notes
No response
Metadata
Metadata
Assignees
Labels
feat/diagnosticsRelated to the diagnostics featureRelated to the diagnostics feature