Skip to content

Type Function Dependency issue UnitTest template #1714

@karl-police

Description

@karl-police

Description

TEST_CASE_FIXTURE(ACBuiltinsFixture, "typefunc_dependency_issue1")
{
    ScopedFastFlag sff[]{
        {FFlag::LuauSolverV2, true},
    };

    CheckResult check1 = check(R"(
local tbl_A = {} :: typeof({entry1 = 1})
tbl_A.entry1b = "test"

type tbl_B = {entry2: nil}
local tbl_C = nil :: getmetatable< typeof( setmetatable({}, {entry3b="test"}) ) >
tbl_C.entry3 = "test" 
tbl_C.entry4 = "test"

local test = nil :: typeof(tbl_C)
local tbl_ABC = nil :: typeof(tbl_A) & tbl_B & typeof(tbl_C)

local indexesABC = nil :: keyof<typeof(tbl_ABC)>
)");

    auto test1 = requireType("indexesABC");

    if (auto ty = follow(test1)->ty.get_if<UnionType>())
    {
        CHECK_EQ(ty->options.size(), 6);
    }
    else
        LUAU_ASSERT(false); // It should be a UnionType
}

Expected Result

That entry3 and entry4 is included inside indexesABC

Here is a result with #1425

Image

Actual Result

Only 4 results show up, instead of 6.

entry3 and entry4 is missing, there used to be a time where I think I knew why it was missing. I think it's because it was trying to use stat assign on a pending expansion, don't recall anymore. I only remember that I made a variation of a fix for it and put everything there.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnew solverThis issue is specific to the new solver.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions