Skip to content

Unknown type when dividing two numbers (2) #2236

Open
@RomanSpector

Description

@RomanSpector

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

image

Actual Behaviour

image

image

image

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: #2036

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfeat/type checkRelated to the type checking feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions