Skip to content
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: Fix inconsistency in order of observable operations in ...FromFields() for non-ISO calendars #2377

Merged
merged 1 commit into from
Sep 15, 2022

Conversation

ptomato
Copy link
Collaborator

@ptomato ptomato commented Aug 15, 2022

Previously, the monthDayFromFields() method of non-ISO calendars behaved
differently from dateFromFields() and yearMonthFromFields(), checking the
overflow option after accessing the fields whereas the other two checked
the overflow option first.

This normative change fixes this inconsistency.

Split out from #2199 which does not need to be normative. Note this will need a rebase when #2199 is merged.

@ptomato ptomato added spec-text Specification text involved normative Would be a normative change to the proposal labels Aug 15, 2022
@codecov
Copy link

codecov bot commented Aug 15, 2022

Codecov Report

Merging #2377 (6d66459) into main (5c69928) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2377   +/-   ##
=======================================
  Coverage   95.01%   95.01%           
=======================================
  Files          20       20           
  Lines       10803    10803           
  Branches     1925     1925           
=======================================
  Hits        10264    10264           
  Misses        503      503           
  Partials       36       36           
Impacted Files Coverage Δ
polyfill/lib/calendar.mjs 83.53% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the polyfill should also be updated.

spec/intl.html Outdated Show resolved Hide resolved
@ptomato ptomato force-pushed the observable-order-inconsistency branch from 60fc723 to 95bfd89 Compare August 17, 2022 20:23
@ptomato ptomato requested a review from gibson042 August 23, 2022 18:24
@ptomato
Copy link
Collaborator Author

ptomato commented Aug 23, 2022

I'll mark this as a draft in anticipation of presenting it at the next TC39 meeting.

@ptomato ptomato marked this pull request as draft August 23, 2022 18:53
@ptomato ptomato force-pushed the observable-order-inconsistency branch from 95bfd89 to 875c5bb Compare August 25, 2022 00:11
ptomato added a commit to tc39/how-we-work that referenced this pull request Aug 26, 2022
Triggered by the discussion in tc39/proposal-temporal#2377 (comment)
Arguments should consistently be processed in order.
ptomato added a commit to ptomato/test262 that referenced this pull request Sep 14, 2022
This implements the normative change in
tc39/proposal-temporal#2377 which reached
consensus at the September 2022 TC39 meeting.

It changes the order in which observable operations are performed on the
values passed to the ___fromFields methods of Calendar.
@ptomato ptomato marked this pull request as ready for review September 14, 2022 22:31
@ptomato
Copy link
Collaborator Author

ptomato commented Sep 14, 2022

This reached consensus at the September 2022 TC39 meeting. Tests are in tc39/test262#3666

Ms2ger pushed a commit to tc39/test262 that referenced this pull request Sep 15, 2022
This implements the normative change in
tc39/proposal-temporal#2377 which reached
consensus at the September 2022 TC39 meeting.

It changes the order in which observable operations are performed on the
values passed to the ___fromFields methods of Calendar.
@Ms2ger Ms2ger force-pushed the observable-order-inconsistency branch from 875c5bb to bf1b916 Compare September 15, 2022 09:07
Previously, the monthDayFromFields() method of non-ISO calendars behaved
differently from dateFromFields() and yearMonthFromFields(), as well as
monthDayFromFields() of the ISO calendar. The latter checked the overflow
option before accessing the fields, and the former checked the overflow
option afterwards.

This normative change fixes this inconsistency. The general principle is
that arguments to a function should be validated in order, so we go with
accessing the fields before checking the overflow option.

Requires an update to the reference code, which previously consistently
checked the overflow option first.
@Ms2ger Ms2ger force-pushed the observable-order-inconsistency branch from bf1b916 to 6d66459 Compare September 15, 2022 09:11
@Ms2ger Ms2ger dismissed gibson042’s stale review September 15, 2022 09:13

Polyfill is updated.

@Ms2ger Ms2ger merged commit a3a8237 into main Sep 15, 2022
@Ms2ger Ms2ger deleted the observable-order-inconsistency branch September 15, 2022 09:23
balusch pushed a commit to balusch/v8 that referenced this pull request Sep 24, 2022
Sync to the spec/calendar.html changes in
tc39/proposal-temporal#2377
to change the order of calling ToTemporalOverflow.
This cl only cover the ISO8601 part, the the intl part of the PR
is not yet implemented and will be handle when e implemenet them.

Spec text:
https://tc39.es/proposal-temporal/#sec-temporal-isodatefromfields
https://tc39.es/proposal-temporal/#sec-temporal-isoyearmonthfromfields
https://tc39.es/proposal-temporal/#sec-temporal-isomonthdayfromfields

Bug: v8:11544
Change-Id: Ia4386d460dc45b0b377a483c6f4793da4cbd7c20
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3903223
Commit-Queue: Frank Tang <[email protected]>
Reviewed-by: Adam Klein <[email protected]>
Cr-Commit-Position: refs/heads/main@{#83410}
catamorphism pushed a commit to catamorphism/test262 that referenced this pull request Oct 4, 2022
This implements the normative change in
tc39/proposal-temporal#2377 which reached
consensus at the September 2022 TC39 meeting.

It changes the order in which observable operations are performed on the
values passed to the ___fromFields methods of Calendar.
catamorphism pushed a commit to catamorphism/test262 that referenced this pull request Oct 5, 2022
This implements the normative change in
tc39/proposal-temporal#2377 which reached
consensus at the September 2022 TC39 meeting.

It changes the order in which observable operations are performed on the
values passed to the ___fromFields methods of Calendar.
ptomato added a commit to tc39/how-we-work that referenced this pull request Feb 13, 2023
Triggered by the discussion in tc39/proposal-temporal#2377 (comment)
Arguments should consistently be processed in order.
ptomato added a commit to tc39/how-we-work that referenced this pull request Jun 27, 2024
Triggered by the discussion in tc39/proposal-temporal#2377 (comment)
Arguments should consistently be processed in order.
ptomato added a commit to tc39/how-we-work that referenced this pull request Jul 12, 2024
Triggered by the discussion in tc39/proposal-temporal#2377 (comment)
Arguments should consistently be processed in order.
ptomato added a commit to tc39/how-we-work that referenced this pull request Jul 16, 2024
Triggered by the discussion in tc39/proposal-temporal#2377 (comment)
Arguments should consistently be processed in order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
normative Would be a normative change to the proposal spec-text Specification text involved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants