-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invalid Assertion in BalanceISODate #2396
Comments
could you tell me where is the throw of the RangeError in "! BalanceISOYearMonth(....)" won't throw, right? |
Yes,
It should probably throw in (*) |
ok, I think I misread. your comment earlier on. so you mean that should be throw earlier on in BalanceISOYearMonth but the spec text currently does not throw, right? |
Is that enough? What if in the input weeks is Number.MAX_VALUE or days is Number.MAX_VALUE ? that will make BalanceISOYearMonth or RegulateISODate not throwing (since neither weeks or days are used for that two calls) but will/may reach BalanceISODate with a date = Infinity right? |
Yes, when either |
Yes, exactly that. |
I think this is covered by #2315. Thanks for the code example, I'll copy it over there. |
https://tc39.es/proposal-temporal/#sec-temporal-balanceisodate has the following code
...
From https://github.com/tc39/test262/blob/main/test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-duration-years-and-months-number-max-value.js
Let's has
Now, we will get into
AddISODate ( year, month, day, years, months, weeks, days, overflow )
as
AddISODate ( 1970, 1, 1, Number.MAX_VALUE, Number.MAX_VALUE, 0, 0, overflow )
and get into BalanceISODate() with a not finite years and therefore MakeDay() will return a NaN
But then we will have this assertion violation
2. Assert: epochDays is finite.
Or did I missed something? @ptomato @anba @ljharb @gibson042 @sffc @ryzokuken
The text was updated successfully, but these errors were encountered: