-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
field function bug #3089
Comments
this is the result of a git bisect 🤔
which is #2864 by @lewis6991 Some observation: by flipping the ---@class Person
---@field age? number
---@field foo fun(x: number, y: number)
---@param person Person
local function test(person)
if (person.age ~= nil) then
local aa = person.age -- type is number?
end
if (person.foo == nil) then --< flip this to `==`
local bb = person.foo --> fun(x: number, y: number)
end
end |
lewis6991
added a commit
to lewis6991/lua-language-server
that referenced
this issue
Feb 27, 2025
Fixes LuaLS#3089 Fixes LuaLS#2952 Fixes LuaLS#3056
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Expected Behaviour
Looking at this code, the variable local bb should be of type fun(x: number, y: number).
the variable local aa should be of type number.
`---@Class Person
---@field age? number
---@field foo? fun(x: number, y: number)
---@param person Person
local function test(person)
if (person.age ~= nil) then
local aa = person.age -- type is number?
end
if (person.foo ~= nil) then
local bb= person.foo -- type is unknown
end
end
`
Actual Behaviour
the variable local aa be of type number?
the variable local bb be of type unknown
Reproduction steps
Additional Notes
No response
Log File
No response
The text was updated successfully, but these errors were encountered: