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
It to understand the comparison is bogus and not affect the expected type of the parent table.
Actual Behaviour
It somehow makes the parent table unknown?
Reproduction steps
Very specifically the ~= does this. Change it to A.b == {} or even not A.b == {} and it works fine.
But with ~=, A becomes unknown within the condition (not even after it)
---@class A
---@field b {[C]:D}
local A
if A.b ~= {} then
local C = A
end
Additional Notes
Comparing to a table literal should probably warn that it'll never be true (or false)
Log File
service.log
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
It to understand the comparison is bogus and not affect the expected type of the parent table.
Actual Behaviour
It somehow makes the parent table unknown?
Reproduction steps
Very specifically the
~=does this. Change it toA.b == {}or evennot A.b == {}and it works fine.But with
~=, A becomes unknown within the condition (not even after it)Additional Notes
Comparing to a table literal should probably warn that it'll never be true (or false)
Log File
service.log