luau icon indicating copy to clipboard operation
luau copied to clipboard

new solver bug with negative number literals

Open jackdotink opened this issue 1 year ago • 2 comments

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.

jackdotink avatar Oct 20 '24 18:10 jackdotink

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)

jackdotink avatar Oct 20 '24 19:10 jackdotink

Thanks for the report! The fix for this barely missed this week's release, it should land next week.

hgoldstein avatar Feb 28 '25 23:02 hgoldstein

Closing this out: I believe this one is long fixed, but at the least the example given reports no errors.

hgoldstein avatar Jun 20 '25 18:06 hgoldstein