As showcased in the post below, i’m currently trying to replace the type of a function’s argument:
After some further testing I came across 3 issues.
First one being that the new solver fails to correctly evalate if a type exists unless you directly compare it with ‘types.singleton(nil)’, as was the case in the prior code:
local valueType = valueTypes.read or valueTypes.write
if valueType and valueType:is("function") then
--Doesn't work
end
local valueType = assert(valueTypes.read or valueTypes.write, "'valueType' expected.")
if valueType:is("function") then
--Works
end
local head, tail = params.head, params.tail
if head and (head[1] == class or head[1] == object) then
--Doesn't work
end
local head, tail = params.head, params.tail
local head = head ~= types.singleton(nil) and head or {}
if head[1] == class or head[1] == object then
--Works, but 'head[1]' will display a warning
end
This wouldn’t be as much of an issue, if that didn’t cause warnings like in the last example, which leads to issue 2, using assertions doesn’t display a warning in the type function caller when something goes wrong, making it extremely difficult to debug.
Lastly is issue 3, which is that even after dealing with the previous and attempting to replace the type, the names of the arguments are still missing, instead returning an underscore:
local head = head ~= types.singleton(nil) and head or {}
if (head[1] == number) then --Changed types to number for testing purposes
--if head[1] == types.number then
--head[1] = head[1]
--end
valueType:setparameters(head, tail)
--Insert to obj
object:setproperty(keyType, valueType)
end
In this example which is taken from the quoted post, 2 tables were passed, table1 (class) having ‘Salutations(Count: number)’, which is added to table2 (object).
The expected result in this case would be for ‘Salutations(Count: number)’ to be added to object, but instead this results in ‘Salutations(_: number)’, which is not what I’d expect when manipulating the arguments in a function.
Expected behavior
- I expect conditionals to evaluate if a type is nil without explicitly comparing them to a nil singleton (and if not possible i’d expect warnings to be supressed after comparing the type to the singleton).
- I expect the errors in my assertions to be displayed as a warning in the line the type function was called so I can debug correctly.
- I expect ‘type:arguments()’ to return the name of the arguments (even if they can’t be manipulated directly, they should still be preserved, and if not, a way to do so should be provided).
A private message is associated with this bug report

