-
Notifications
You must be signed in to change notification settings - Fork 464
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
Temporal: Remove support for nested property bags from TimeZone/Calendar protocol, and change validation #3813
Conversation
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.
Wow, amazing to get this done. Only a few minor nits & questions.
test/intl402/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-datetime.js
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,24 @@ | |||
// Copyright (C) 2022 Igalia, S.L. All rights reserved. |
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.
I saw a few brand-new tests in this PR that seem unrelated to the nested property bags. That seems fine to me, just wanted to confirm that this was intended.
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.
Yeah, the story behind this one is that it should've been here but for some reason was missing from PlainYearMonth.compare. (Probably an oversight on my part.) It would've previously had a nested property bag in it, which I would've removed in this PR.
test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-wrong-type.js
Show resolved
Hide resolved
test/built-ins/Temporal/PlainDate/prototype/toString/calendarname-undefined.js
Show resolved
Hide resolved
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.
I trust Philip and Justin here.
Previously, "nested" time zone property bags were unwrapped up to one level. That is, this object: { timeZone: { // ...Temporal.TimeZone methods } } would not be considered to implement the TimeZone protocol, but would have its timeZone property used instead, if it were passed to an API that required a TimeZone protocol object. These nested property bags are no longer supported. Discussion: tc39/proposal-temporal#2104 (comment) Corresponding normative PR: tc39/proposal-temporal#2485
Previously, "nested" calendar property bags were unwrapped up to one level. That is, this object: { calendar: { // ...Temporal.Calendar methods } } would not be considered to implement the Calendar protocol, but would have its calendar property used instead, if it were passed to an API that required a Calendar protocol object. These nested property bags are no longer supported. Discussion: tc39/proposal-temporal#2104 (comment) Corresponding normative PR: tc39/proposal-temporal#2485
Checking whether an object implements the TimeZone protocol is now done by means of HasProperty operations for each of the required methods unless the object already has the TimeZone brand. Discussion: tc39/proposal-temporal#2104 (comment) Corresponding normative PR: tc39/proposal-temporal#2485
Checking whether an object implements the Calendar protocol is now done by means of HasProperty operations for each of the required methods unless the object already has the Calendar brand. Discussion: tc39/proposal-temporal#2104 (comment) Corresponding normative PR: tc39/proposal-temporal#2485
Suggestion from Justin Grant's code review.
Thanks for the reviews! |
Normative PR: tc39/proposal-temporal#2485 which reached consensus in the January/February 2023 TC39 meeting.
The required changes to tests involve a lot of search-and-replace so I'd recommend reviewing this PR commit by commit and probably skimming over the boring parts. The good news is that the tests become much simpler overall, reflecting a simplification of the TimeZone and Calendar protocols in Temporal.