Dynamic Function with Type Pack return placed into a table crashes studio

Reproduction Steps
this can be placed into any script or module

local function x<T...>(func: ()->(T...))
	local r = {func()}
end

Expected Behavior
Should be no crash and give a warning like when trying to place a variadic type pack into a table.
example

Actual Behavior
A warning appears in script analysis “Luau ran into an unexpected error and will not type check until Studio is restarted.” and a moment later studio closes without any error dialog.

Workaround
table.pack

local function x<T...>(func: ()->(T...))
	local r = table.pack(func()) -- r is {[number]: nil, n: number}
end

and casting

local function x<T...>(func: ()->(T...))
	local r = {(func :: any)()} -- r is {any}
end

Issue Area: Studio
Issue Type: Crashing
Impact: Moderate
Frequency: Often

I just tested this out, studio doesn’t crash for me but I get
Luau ran into an unexpected error and will not type check until Studio is restarted.

Edit: After making another script with the same content, studio did crash, which implies it isn’t 100% of the time but is very frequent.

That is odd. Crashing was happening every time before but now is somewhat often. Perhaps just a bad streak of luck in the beginning.

We have prepared a fix for this issue. It should be available in the next Studio update.

2 Likes

Not too sure when the update released but it seems to have done the trick. No more issues with studio or the type checker crashing from this.