luau-lang/luau

"Free Types and {- -}" causes the "autocomplete type and owning area MainModule" to be appended in the old type solver, and don't work in the new type solver

Closed this issue · 2 comments

TEST_CASE_FIXTURE(ACBuiltinsFixture, "idk4")
{
    ScopedFastFlag sff[]{
        {FFlag::DebugLuauDeferredConstraintResolution, false},
        {FFlag::DebugLuauLogSolver, true},
    };

    auto check1 = check(R"(
function abc<free>(a)
	local b = a :: typeof({})
	b.abc = "hi"


	return b :: typeof(b) & typeof(a) & free
end


local test = {}
test.idk = "hi"

local e = abc(test)
print(e.no)
e.TheIs_doesntActual_Properlty="e"
e.this_doesnt_act_properly@1
)");

    auto ac1 = autocomplete('1');
    ac1;
    //CHECK(ac1.entryMap.count("TheIs_doesntActual_Properlty"));
}

Description

I am using an unassigned generic type, in the old typesolver, to assign it to the output. You can replace free with typeof(table.clone()) as well.

The purpose of adding free onto the table, is to keep the table extendable for the autocomplete. This works, however whatever the Autocomplete uses to show the properties, is being revealed, which is a BUG that I thought would be not a Luau issue, but then I tested it and it is a Luau issue.

Expected Result

e should NOT have
e.no and e.this_doesnt_act_properly

These fields aren't being assigned, they're just being read, they don't exist.

Actual Result

image

anything after the . is being added to the type for some reason
the same goes for typeof(table.clone()) instead of using free

It is revealing the autocomplete

Notes

all of the suspicious types are in a different typeId compared to the other one

typeof(setmetatable()) would work too