-
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
Normative: Validate results of Calendar operations #2265
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2265 +/- ##
==========================================
- Coverage 95.03% 94.78% -0.26%
==========================================
Files 20 20
Lines 10881 10890 +9
Branches 1934 1925 -9
==========================================
- Hits 10341 10322 -19
- Misses 504 532 +28
Partials 36 36
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This can go on the list to present at the next plenary. I'll mark it as draft so it is not merged accidentally before then.
Would you mind splitting the second commit (removing the checks for undefined) into a separate editorial pull request?
4f9ffba
to
7ed8abb
Compare
Moved into #2332. |
The existing tests would fail after making the normative change from tc39/proposal-temporal#2265 because they rely on the getter directly returning whatever value the calendar method returned. This is no longer the case, because the value returned by the calendar is validated, so adjust the assertions in these tests. Also, no longer any need to return a value from the calendar method that needs to be converted; we'll add separate tests for that. Expand these tests to cover all of the PlainDate, PlainDateTime, PlainMonthDay, PlainYearMonth, and ZonedDateTime property getters that delegate to the calendar methods.
This adds tests for the normative change in tc39/proposal-temporal#2265, which adds validation steps to certain abstract operations that call Temporal.Calendar methods. These had some duplication with some existing tests named calendar-returns-infinity.js. Remove these, because the new tests are more complete in testing what values are accepted.
389dc78
to
b6945af
Compare
This reached consensus in July 2022. I've rebased it and addressed my comment about 𝔽(), and added an implementation of the normative change to the reference code. Tests are in tc39/test262#3681, we'll need to update test262 once that's merged, since this invalidates some existing test262 tests. |
The existing tests would fail after making the normative change from tc39/proposal-temporal#2265 because they rely on the getter directly returning whatever value the calendar method returned. This is no longer the case, because the value returned by the calendar is validated, so adjust the assertions in these tests. Also, no longer any need to return a value from the calendar method that needs to be converted; we'll add separate tests for that. Expand these tests to cover all of the PlainDate, PlainDateTime, PlainMonthDay, PlainYearMonth, and ZonedDateTime property getters that delegate to the calendar methods.
This adds tests for the normative change in tc39/proposal-temporal#2265, which adds validation steps to certain abstract operations that call Temporal.Calendar methods. These had some duplication with some existing tests named calendar-returns-infinity.js. Remove these, because the new tests are more complete in testing what values are accepted.
The operation preamble already stated "[...] and validates the result.", but not actual validation took place.
`CalendarDaysInMonth` already calls `ToPositveInteger`.
The normative change in this PR changed the return types of these operations from "ECMAScript language value" to "integer", which means we need to convert them back to ECMAScript floats when exposing them to JS.
This adds structured headers to the abstract operations that call the calendar methods that back the Plain types' property getters. May as well do it while I was correcting the return types anyways.
This implements the changes from "Normative: Add missing validation to remaining Calendar operations", which adds a validation step to the abstract operations that call certain Temporal.Calendar methods.
These checks are all redundant due to ES.ToPositiveInteger() being called elsewhere in the same path.
b6945af
to
697e7bb
Compare
697e7bb
to
31de2c7
Compare
The validation was already mentioned in the preamble of each operation, but it wasn't actually performed.