luau-lang / luau

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

NEW SOLVER: `table.freeze()` issues; TypeError when freezing a table with a metatable, and missing first argument crashes the solver #1498

Open imnerolin opened 3 weeks ago

imnerolin commented 3 weeks ago
local meta = {
    __index = function()
        return "foo"
    end
}

local myTable = setmetatable({}, meta)
table.freeze(myTable)
--[=[
    table.freeze( ** myTable) **
    TypeError: Type 'myTable' could not be converted into 'table'
]=]

also: table.freeze with a missing first argument crashes the entire solver

local myTable = setmetatable({}, meta)
-- if you were trying to type table.freeze(meta)
-- then the entire solver would crash, forcing you to
-- restart whatever you're coding on
table.freeze() -- Crash!
imnerolin commented 3 weeks ago

seems to be an issue with the luau language server plugin on VS code, this doesn't occur in roblox studio or neovim

aatxe commented 3 weeks ago

Neither of these are specific to luau-lsp, the relevant flag is just not on in Roblox Studio yet. It is a valid issue.