Skip to content

Empty array union doesn't get index increment #478

@ark120202

Description

@ark120202

Input:

const foo = (): [string, string] | [string] => null!;
const bar = (): [string] | [] => null!;
print(foo()[0]);
print(bar()[0]);

Current Result:

local foo;
foo = function()
    return nil;
end;
local bar = function()
    return nil;
end;
print(foo()[0 + 1]);
print(bar()[0]);

Expected Result:

local foo;
foo = function()
    return nil;
end;
local bar;
bar = function()
    return nil;
end;
print(foo()[0 + 1]);
print(bar()[0 + 1]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions