Skip to content

Fragmental AC - table mutation with metatable through functions is broken #2132

@karl-police

Description

@karl-police

Description

If you pass a table with a metatable through a function to mutate the table, it seems like the new solver puts the tables together in a strange way.

Autocomplete marker marked at obj.@1

local name = {}
name.__index = name

function name.new()
	local obj = setmetatable({}, name)
	
	obj = name.prepare(obj)
	
	obj.@1
	
	return obj
end


function name.prepare(obj)
	obj.Entry1 = {
		entries = {} :: {string}
	}
	
	obj.Value1 = 2
	
	
	return obj
end


return name

Expected Result

That obj.@1 contains Entry1 and Value1 in a normal way. Works in the Old Solver.

Actual Result

At obj.@1 there's now a problem { @metatable name, { } } | { Entry1: { entries: {string} }, Value1: number }

because of this, the autocomplete doesn't work

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions