Skip to content

The integer addition loop has a bug #3351

@iamhaiwen

Description

@iamhaiwen

---@param bag table<integer, integer>
---@return integer
---@NODISCARD
local function foo(bag)
local sum = 0
for _, count in pairs(bag) do
sum = sum + count
end
return sum -- bug! sum is unknown
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions