New Type Solver does not allow metatable removal

As stated here, metatables should be allowed to be removed from types in the New Type Solver. I did some research before and normally one would call setmetatable(t, nil) on regular variable to remove the metatable at run time but setting the type as setmetatable<mt, nil> does not remove it at all. Code example:

type original = {}
type meta = setmetatable<original, {}>
type new = setmetatable<meta, nil> -- Type Error: Type function instance setmetatable<meta, nil> is uninhabitated
1 Like

Hello again, and thank you for beta testing the new type solver!

As mentioned it seems like this is an oversight given that the old solver understands that setmetatable(X, nil) means “please remove the metatable of X.”

1 Like