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

Refactor Temporal Calendar API for AnyCalendar and fields #3522

Merged
merged 5 commits into from Dec 28, 2023

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Dec 18, 2023

This PR is related to the ongoing work for Temporal.

The largest change on this PR is primarily updating CalendarSlot.

// Old CalendarSlot
enum CalendarSlot {
    Identifier(String),
    Protocol(Box<dyn CalendarProtocol>),
}

// New CalendarSlot
enum CalendarSlot<C: CalendarProtocol> {
    Builtin(AnyCalendar),
    Protocol(C),
}

It changes the following:

  • Switches CalendarSlot::Protocol(Box<dyn CalendarProtocol>) to CalendarSlot::Protocol(C).
  • Switches CalendarSlot::Identifier(String) to CalendarSlot::Builtin(AnyCalendar)
  • Updates CalendarProtocol to include fields and mergeFields.

I think there are still a couple things I want to double check/work through. But posting this as a draft in the meantime for any early feedback/thoughts.

Copy link

Test262 conformance changes

Test result main count PR count difference
Total 95,960 95,960 0
Passed 76,534 76,534 0
Ignored 18,477 18,477 0
Failed 949 949 0
Panics 0 0 0
Conformance 79.76% 79.76% 0.00%

Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 471 lines in your changes are missing coverage. Please review.

Comparison is base (c2f145c) 48.97% compared to head (0ad2add) 48.83%.
Report is 10 commits behind head on main.

Files Patch % Lines
core/temporal/src/components/calendar.rs 9.75% 185 Missing ⚠️
core/temporal/src/fields.rs 0.00% 119 Missing ⚠️
core/engine/src/builtins/temporal/calendar/mod.rs 16.83% 84 Missing ⚠️
...re/engine/src/builtins/temporal/calendar/object.rs 0.00% 45 Missing ⚠️
core/engine/src/builtins/temporal/fields.rs 0.00% 21 Missing ⚠️
core/temporal/src/components/duration.rs 0.00% 3 Missing ⚠️
...ngine/src/builtins/temporal/plain_date_time/mod.rs 0.00% 2 Missing ⚠️
...ngine/src/builtins/temporal/plain_month_day/mod.rs 0.00% 2 Missing ⚠️
core/temporal/src/components/date.rs 50.00% 2 Missing ⚠️
core/temporal/src/components/zoneddatetime.rs 33.33% 2 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3522      +/-   ##
==========================================
- Coverage   48.97%   48.83%   -0.15%     
==========================================
  Files         471      470       -1     
  Lines       48498    48674     +176     
==========================================
+ Hits        23752    23769      +17     
- Misses      24746    24905     +159     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 45 to 44
#[boa_gc(unsafe_empty_trace)]
pub struct Calendar {
slot: CalendarSlot,
slot: CalendarSlot<JsCustomCalendar>,
Copy link
Member

@jedel1043 jedel1043 Dec 18, 2023

Choose a reason for hiding this comment

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

Thanks to the new design, we can remove the unsafe_empty_trace and properly implement Trace for CalendarSlot<C: Trace>.

@nekevss nekevss marked this pull request as ready for review December 22, 2023 16:54
@nekevss
Copy link
Member Author

nekevss commented Dec 22, 2023

Marking as ready for review as I believe the core changes for CalendarSlot<C> are complete. There are still a few things that could be improved on this branch, specifically around the functionality of new builtin calendars from AnyCalendar as well as CalendarDescriptorFields, CalendarFieldKeysToIgnore, and CalendarResolveField (I have a rough idea of what needs to be there, but just wanted to do some further research to confirm).

@jedel1043 jedel1043 added builtins PRs and Issues related to builtins/intrinsics waiting-on-review Waiting on reviews from the maintainers labels Dec 25, 2023
@nekevss nekevss requested a review from a team December 26, 2023 03:10
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Great work! :)

core/temporal/src/fields.rs Outdated Show resolved Hide resolved
@HalidOdat HalidOdat requested a review from a team December 26, 2023 17:11
@HalidOdat HalidOdat added this to the v0.18.0 milestone Dec 26, 2023
Copy link
Member

@raskad raskad left a comment

Choose a reason for hiding this comment

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

Looks good to me. I agree with @HalidOdat's comment but that should not block the merge :)

@raskad raskad added this pull request to the merge queue Dec 28, 2023
Merged via the queue into main with commit 1ef04a7 Dec 28, 2023
14 checks passed
@nekevss nekevss deleted the temporal-any-calendar branch December 30, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics waiting-on-review Waiting on reviews from the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants