Reassigning Table Type Variable Inside of If Statement Causes that Variable to Accept Any Type as a Value in the New Luau Type Solver.

When assigning a value in a table with the type {string} to a value of any other type, it errors unless you set the table to another table inside of an if statement before. The if statement is critical as the discrepancy does not occur without it.
To reproduce this issue just paste the following codeblock into any script inside of roblox studio with UseNewLuauTypeSolver enabled:

--!strict
local SplitString: { string } = {"1", "2", "3"}

if true then
	SplitString = {"1","2","3"}
end

SplitString[1] = 2 --does not error
SplitString[2] = true --does not error
SplitString[3] = {SplitString} --does not error
SplitString = {1,2,3} -- errors

Expected behavior

I expect all four following assignments to error as they violate the type of the table containing them.

1 Like