lua-language-server
                                
                                 lua-language-server copied to clipboard
                                
                                    lua-language-server copied to clipboard
                            
                            
                            
                        Unknown type when dividing two numbers (2)
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
Actual Behaviour
Reproduction steps
local count = 0;
local time = 0;
local allcount = 0;
local alltime = 0;
local avg = 0;
---@type integer[]
local allstats = {}
for i, value in ipairs(allstats) do
    count     = count + 1;
    time      = time + 1;
    allcount  = allcount + 1;
    alltime   = alltime + 1;
end
if allcount > 0 then
   avg = alltime / allcount;
end
Additional Notes
Previous fix: https://github.com/LuaLS/lua-language-server/issues/2036
Log File
No response
That is very odd. If you remove the for loop, it seems to work just fine. Also, if you just comment out allcount = allcount + 1, the if statement has the correct type, but the line under it says allcount: unknown.
up
After the 3.9.0 update, the problem worsened
https://github.com/LuaLS/lua-language-server/assets/57856647/82e338eb-b3dd-47c6-848d-bee445cf5598