-
-
Notifications
You must be signed in to change notification settings - Fork 410
Open
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
I expect both methods to report the "need check nil" diagnostic:
---@class Y
---@field z string
---@class X
---@field y Y?
local X = {}
function X:no_warning()
print(self.y.z) -- no diagnostics
end
function X:warning()
local y = self.y
print(y.z) -- need-check-nil
endActual Behaviour
The potential problem is only reported when using a local variable.
Reproduction steps
Try the code above. and note how only the first method (no_warning) works without any diagnostics.
Additional Notes
No response
Log File
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels