luau-lang / luau

A fast, small, safe, gradually typed embeddable scripting language derived from Lua
https://luau-lang.org
MIT License
3.79k stars 349 forks source link

`table.freeze` returns type `{+ +}` with new solver's strict mode #1272

Open Ketasaja opened 1 month ago

Ketasaja commented 1 month ago

Tested on 0.627 with no errors in non-strict mode.

--!strict
type k = {
    k: string,
}

function _(): k
    return table.freeze({
        k = "",
    }) -- TypeError: Type pack '{+  +}' could not be converted into 'k'; at [0], {+  +} is not a subtype of k
end
karl-police commented 1 month ago

Same is for table.clone()

local test: typeof(table.clone())