lua-language-server
lua-language-server copied to clipboard
No warning when assign constant `nil` to required table field
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Linux
What is the issue affecting?
Type Checking
Expected Behaviour
Warning when assign constant nil
to required table field
as it happens with ordinary variables
Actual Behaviour
Reproduction steps
---@type number
local n
n = nil
n = 1
---@class A
---@field n number
---@type A
local a = { n = nil }
a.n = 1
local NIL = nil
a.n = NIL
-- BUT no warning
a.n = nil -- ?
_ = { a, n }
Additional Notes
Most likely this is a duplicate but I couldn't find the issue
Log File
No response
why? https://github.com/LuaLS/lua-language-server/commit/e5f07d0c9830afdfa1ce3b354a123212e5837526