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

[Merged by Bors] - Partial implementation for Intl.DateTimeFormat #2025

Closed

Conversation

NorbertGarfield
Copy link
Contributor

@NorbertGarfield NorbertGarfield commented Apr 11, 2022

This Pull Request provides initial implementation for DateTimeFormat constructor. It relates to #1562.

It changes the following:

  • Adds Intl.DateTimeFormat property
  • Partially implements DateTimeFormat constructor (InitializeDateTimeFormat step is postponed).
  • Introduces ObjectData::DateTimeFormat

@codecov
Copy link

codecov bot commented Apr 11, 2022

Codecov Report

Merging #2025 (eddb5d4) into main (c605fad) will decrease coverage by 0.03%.
The diff coverage is 17.24%.

@@            Coverage Diff             @@
##             main    #2025      +/-   ##
==========================================
- Coverage   43.94%   43.90%   -0.04%     
==========================================
  Files         211      212       +1     
  Lines       18704    18734      +30     
==========================================
+ Hits         8220     8226       +6     
- Misses      10484    10508      +24     
Impacted Files Coverage Δ
boa_engine/src/context/intrinsics.rs 58.59% <0.00%> (-0.61%) ⬇️
boa_engine/src/object/mod.rs 21.08% <0.00%> (-0.03%) ⬇️
boa_engine/src/builtins/intl/date_time_format.rs 12.50% <12.50%> (ø)
boa_engine/src/builtins/intl/mod.rs 28.00% <100.00%> (+6.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c605fad...eddb5d4. Read the comment docs.

boa_engine/src/builtins/intl/mod.rs Outdated Show resolved Hide resolved
boa_engine/src/builtins/intl/mod.rs Outdated Show resolved Hide resolved
boa_engine/src/builtins/intl/mod.rs Outdated Show resolved Hide resolved
@HalidOdat HalidOdat added the enhancement New feature or request label Apr 13, 2022
@HalidOdat
Copy link
Member

VM implementation

Test result main count PR count difference
Total 88,720 88,720 0
Passed 53,146 53,190 +44
Ignored 21,853 21,853 0
Failed 13,721 13,677 -44
Panics 0 0 0
Conformance 59.90% 59.95% +0.05%
Fixed tests (50):
test/intl402/DateTimeFormat/length.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/length.js (previously Failed)
test/intl402/DateTimeFormat/builtin.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/builtin.js (previously Failed)
test/intl402/DateTimeFormat/intl-legacy-constructed-symbol.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/intl-legacy-constructed-symbol.js (previously Failed)
test/intl402/DateTimeFormat/instance-proto-and-extensible.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/instance-proto-and-extensible.js (previously Failed)
test/intl402/DateTimeFormat/name.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/name.js (previously Failed)
test/intl402/DateTimeFormat/intl-legacy-constructed-symbol-on-unwrap.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/intl-legacy-constructed-symbol-on-unwrap.js (previously Failed)
test/intl402/DateTimeFormat/prop-desc.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prop-desc.js (previously Failed)
test/intl402/DateTimeFormat/constructor-no-instanceof.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/constructor-no-instanceof.js (previously Failed)
test/intl402/DateTimeFormat/legacy-regexp-statics-not-modified.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/legacy-regexp-statics-not-modified.js (previously Failed)
test/intl402/DateTimeFormat/prototype/builtin.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/builtin.js (previously Failed)
test/intl402/DateTimeFormat/prototype/prop-desc.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/prop-desc.js (previously Failed)
test/intl402/DateTimeFormat/prototype/toStringTag/toString-removed-tag.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/toStringTag/toString-removed-tag.js (previously Failed)
test/intl402/DateTimeFormat/prototype/toStringTag/toString-changed-tag.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/toStringTag/toString-changed-tag.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRange/this-bad-object.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRange/date-undefined-throws.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRange/date-undefined-throws.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRange/this-is-not-object-throws.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRange/this-is-not-object-throws.js (previously Failed)
test/intl402/DateTimeFormat/prototype/format/no-instanceof.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/format/no-instanceof.js (previously Failed)
test/intl402/DateTimeFormat/prototype/constructor/value.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/constructor/value.js (previously Failed)
test/intl402/DateTimeFormat/prototype/constructor/prop-desc.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/constructor/prop-desc.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatToParts/this-has-not-internal-throws.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatToParts/this-has-not-internal-throws.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatToParts/this-is-not-object-throws.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatToParts/this-is-not-object-throws.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRangeToParts/this-bad-object.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRangeToParts/this-bad-object.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-undefined-throws.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRangeToParts/date-undefined-throws.js (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRangeToParts/this-is-not-object-throws.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/prototype/formatRangeToParts/this-is-not-object-throws.js (previously Failed)
test/intl402/DateTimeFormat/supportedLocalesOf/taint-Object-prototype.js [strict mode] (previously Failed)
test/intl402/DateTimeFormat/supportedLocalesOf/taint-Object-prototype.js (previously Failed)
Broken tests (6):
test/intl402/DateTimeFormat/constructor-options-style-conflict.js [strict mode] (previously Passed)
test/intl402/DateTimeFormat/constructor-options-style-conflict.js (previously Passed)
test/intl402/DateTimeFormat/this-value-ignored.js [strict mode] (previously Passed)
test/intl402/DateTimeFormat/this-value-ignored.js (previously Passed)
test/intl402/NumberFormat/this-value-ignored.js [strict mode] (previously Passed)
test/intl402/NumberFormat/this-value-ignored.js (previously Passed)

@NorbertGarfield
Copy link
Contributor Author

NorbertGarfield commented Apr 13, 2022

@HalidOdat it seems to me that 6 failing tests were previously passing because DateTimeFormat was unavailable. E.g. test/intl402/DateTimeFormat/constructor-options-style-conflict.js:

  assert.throws(TypeError, function() {
    new Intl.DateTimeFormat("en", { [option]: value, timeStyle: "short" });
  }, `new Intl.DateTimeFormat("en", { ${option}: "${value}",  timeStyle: "short" }) throws TypeError`);

In order to fix that I need to either implement InitializeDateTimeFormat properly (which seemed a little bit ambitious to me, so I postponed it) or alter DateTimeFormat constructor to always fail. What would you recommend?

Thanks.

@HalidOdat
Copy link
Member

Sorry for late response

In order to fix that I need to either implement InitializeDateTimeFormat properly (which seemed a little bit ambitious to me, so I postponed it) or alter DateTimeFormat constructor to always fail. What would you recommend?

You can leave it as is, just put a TODO on the steps in the constructor that are not implemented.

@NorbertGarfield
Copy link
Contributor Author

Copy link
Member

@Razican Razican 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 :) thank you for the implementation!!

@Razican Razican requested review from jedel1043, raskad, jasonwilliams, RageKnify and HalidOdat and removed request for HalidOdat April 18, 2022 17:10
@HalidOdat HalidOdat changed the title Initial implementation for Intl.DateTimeFormat Partial implementation for Intl.DateTimeFormat Apr 19, 2022
@Razican
Copy link
Member

Razican commented Apr 19, 2022

bors r+

bors bot pushed a commit that referenced this pull request Apr 19, 2022
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This Pull Request provides initial implementation for DateTimeFormat constructor. It relates to #1562.

It changes the following:

- Adds `Intl.DateTimeFormat` property
- Partially implements `DateTimeFormat` constructor (`InitializeDateTimeFormat` step is postponed).
- Introduces `ObjectData::DateTimeFormat`
@bors
Copy link

bors bot commented Apr 19, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Partial implementation for Intl.DateTimeFormat [Merged by Bors] - Partial implementation for Intl.DateTimeFormat Apr 19, 2022
@bors bors bot closed this Apr 19, 2022
@Razican Razican added this to the v0.15.0 milestone Jun 1, 2022
@Razican Razican added the builtins PRs and Issues related to builtins/intrinsics label Jun 1, 2022
Razican added a commit that referenced this pull request Jun 8, 2022
<!---
Thank you for contributing to Boa! Please fill out the template below, and remove or add any
information as you feel neccesary.
--->

This Pull Request provides initial implementation for DateTimeFormat constructor. It relates to #1562.

It changes the following:

- Adds `Intl.DateTimeFormat` property
- Partially implements `DateTimeFormat` constructor (`InitializeDateTimeFormat` step is postponed).
- Introduces `ObjectData::DateTimeFormat`
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants