Skip to content

Inference failure when conditionally swapping variable? #3426

Description

@iago-lito

Is the following expected? Why does inference fail at all?

local a, b = 5, 8
if a < b then
   b, a = a, b
   -- ^ Unknown: cannot infer type.
end
print("(" .. a .. ", " .. b .. ")")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions