'New Luau type solver' beta causes Roblox Studio to crash in this specific scenario

I was working on a Set class using the new Luau type solver beta and using --!strict mode. I then made another Script to check out if it worked with the Luau type solver. So I wrote the following code to see if it worked. I first created two sets with the same value (specifically the workspace), then joined them together to create mergedSet, then converted it to an array. Then I wanted to check if the firstItem in the array would autocomplete workspace stuff, but instead it crashed my studio!! It happens every time as well.

Here is the code I tried to test it with:

--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Set = require(ReplicatedStorage.Library.Core.Collections.Set)


local mySet = Set.new(workspace)
local otherSet = Set.new(workspace)
local mergedSet = mySet:Join(otherSet)

local array = mergedSet:ToArray()
local firstItem = array[1]

print(firstItem.)

I also noticed very strange types for my sets and variables.

Types

local mySet

local otherSet

local mergedSet

local array

local firstItem

For staff, please refer to the Set class for better clarification.

Set class code

The Set class will be available to staff only, sorry.

System Information:

CPU: AMD Ryzen 5 5500
Memory: 16GB
GPU: NVIDIA GeForce RTX 3060

Expected behavior

I expected firstItem to have a Workspace type as the set’s type would have been Set<Workspace>. Similarly, I expected the autocomplete to work and not crash my Studio.

A private message is associated with this bug report

3 Likes

Hello! Thank you for the report. I tried to replicate your place with your provided scripts, but I am not quite able to reproduce your crash. If possible, could you provide the exact place file where the crash occurs?

The types are definitely strange, I am able to replicate that. We are aware that the new solver can sometimes produce strange looking types and are working on improving the user experience.

3 Likes

Hey, I think I’m having the exact same issue; if need be, I can send my place file privately :slight_smile:

1 Like

Yeah we’d be happy to send our file to you privately to get this fixed, this crash is very annoying haha @MercuryBromine0

@HammerWorks: yes, that would be greatly appreciated!

2 Likes

I’ll go give my scripter a dm the now Dev4523, to give you a DM privately so yous can get this issue fixed, thank you for getting back to us so quick

I have tried to reproduce my own bug, but it doesn’t crash anymore. I suppose you could consider this fixed for my specific case, but I’ve noticed other people in this topic having a similar issue.

Though, I still think the types that were generated by the type solver are kind of strange. I don’t think I did anything wrong in my Set class (which you can check out and review if you have the time).

For that, I am thinking the culprit might be how I define my Set type, which I consider the intersection between {[E]: boolean} and the Set table:

export type Set<E> = {[E]: boolean} & typeof(Set)

Hey, if you still have the current place file that the crash happened, send him a private DM and send him the file if you can, makes it easier for them, You the man!

I have tried to reproduce my own bug, but it doesn’t crash anymore. I suppose you could consider this fixed for my specific case, but I’ve noticed other people in this topic having a similar issue.

Yep! Crashes are a big category of issues and they could happen for all sorts of reasons. I have a reproduction for a crash from another place file.

2 Likes

When I have “New Luau type solver” and “Scripts are non-strict by default” enabled my studio crashes when loading any place file.

Thanks for letting us know! I believe the issue in this thread has been root caused, with a fix on the way. I don’t believe it’s related to non-strict mode. If you have a repro that you’re comfortable sharing; either a place file or an individual script; we can take a look if you open a separate bug report.