luau
luau copied to clipboard
new solver bug with negative number literals
type Range = { min: number?, max: number? }
local function foo(): Range
return { min = -0, max = 0 }
end
local function bar(): Range
return { min = 0, max = 0 }
end
In the above code, the return of foo is a type error, but the return of bar is not a type error. This should not be the case.
The type error is over the span of the entire return of foo: TypeError: Type pack '{ max: number?, min: number }' could not be converted into 'Range'; type { max: number?, min: number }[0][read "min"] (number) is not exactly Range[0][read "min"][1] (nil)
Thanks for the report! The fix for this barely missed this week's release, it should land next week.
Closing this out: I believe this one is long fixed, but at the least the example given reports no errors.