Title: [259370] trunk
Revision
259370
Author
ross.kirsl...@sony.com
Date
2020-04-01 16:15:16 -0700 (Wed, 01 Apr 2020)

Log Message

Intl.NumberFormat.prototype.format must preserve sign of -0
https://bugs.webkit.org/show_bug.cgi?id=209880

Reviewed by Keith Miller.

JSTests:

* test262/config.yaml:
This test was skipped as ICU version-dependent, but it shouldn't be.

* test262/expectations.yaml:
Mark four test cases as passing.

Source/_javascript_Core:

The spec changed here two years ago:
https://github.com/tc39/ecma402/pull/232

* runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::formatNumber):
Do NOT throw away the sign of -0.

LayoutTests:

* js/intl-numberformat-expected.txt:
* js/script-tests/intl-numberformat.js:
Fix test accordingly.

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (259369 => 259370)


--- trunk/JSTests/ChangeLog	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/JSTests/ChangeLog	2020-04-01 23:15:16 UTC (rev 259370)
@@ -1,3 +1,16 @@
+2020-04-01  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        Intl.NumberFormat.prototype.format must preserve sign of -0
+        https://bugs.webkit.org/show_bug.cgi?id=209880
+
+        Reviewed by Keith Miller.
+
+        * test262/config.yaml:
+        This test was skipped as ICU version-dependent, but it shouldn't be.
+
+        * test262/expectations.yaml:
+        Mark four test cases as passing.
+
 2020-04-01  Justin Michaud  <jus...@justinmichaud.com>
 
         Delete IC incorrectly caches for proxies

Modified: trunk/JSTests/test262/config.yaml (259369 => 259370)


--- trunk/JSTests/test262/config.yaml	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/JSTests/test262/config.yaml	2020-04-01 23:15:16 UTC (rev 259370)
@@ -115,8 +115,6 @@
     # https://bugs.webkit.org/show_bug.cgi?id=192920
     - test/intl402/PluralRules/prototype/resolvedOptions/order.js
     - test/intl402/PluralRules/prototype/resolvedOptions/pluralCategories.js
-    - test/intl402/NumberFormat/prototype/format/format-fraction-digits.js
-    - test/intl402/NumberFormat/prototype/format/format-significant-digits.js
 
     # https://bugs.webkit.org/show_bug.cgi?id=190800
     - test/built-ins/TypedArray/prototype/set/src-typedarray-big-throws.js

Modified: trunk/JSTests/test262/expectations.yaml (259369 => 259370)


--- trunk/JSTests/test262/expectations.yaml	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/JSTests/test262/expectations.yaml	2020-04-01 23:15:16 UTC (rev 259370)
@@ -1998,9 +1998,6 @@
 test/intl402/NumberFormat/proto-from-ctor-realm.js:
   default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'
   strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'
-test/intl402/NumberFormat/prototype/format/format-negative-numbers.js:
-  default: 'Test262Error: Intl.NumberFormat is formatting 0 and -0 the same way. Expected SameValue(«0», «0») to be false'
-  strict mode: 'Test262Error: Intl.NumberFormat is formatting 0 and -0 the same way. Expected SameValue(«0», «0») to be false'
 test/intl402/PluralRules/proto-from-ctor-realm.js:
   default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'
   strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'

Modified: trunk/LayoutTests/ChangeLog (259369 => 259370)


--- trunk/LayoutTests/ChangeLog	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/LayoutTests/ChangeLog	2020-04-01 23:15:16 UTC (rev 259370)
@@ -1,3 +1,14 @@
+2020-04-01  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        Intl.NumberFormat.prototype.format must preserve sign of -0
+        https://bugs.webkit.org/show_bug.cgi?id=209880
+
+        Reviewed by Keith Miller.
+
+        * js/intl-numberformat-expected.txt:
+        * js/script-tests/intl-numberformat.js:
+        Fix test accordingly.
+
 2020-04-01  Per Arne Vollan  <pvol...@apple.com>
 
         [macOS] Deny mach-lookup access to "com.apple.lsd.mapdb" in sandbox

Modified: trunk/LayoutTests/js/intl-numberformat-expected.txt (259369 => 259370)


--- trunk/LayoutTests/js/intl-numberformat-expected.txt	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/LayoutTests/js/intl-numberformat-expected.txt	2020-04-01 23:15:16 UTC (rev 259370)
@@ -201,7 +201,7 @@
 PASS Intl.NumberFormat('en').format(Infinity) is '∞'
 PASS Intl.NumberFormat('en').format(-Infinity) is '-∞'
 PASS Intl.NumberFormat('en').format(0) is '0'
-PASS Intl.NumberFormat('en').format(-0) is '0'
+PASS Intl.NumberFormat('en').format(-0) is '-0'
 PASS Intl.NumberFormat('en').format(Number.MIN_VALUE) is '0'
 PASS Intl.NumberFormat('en', { maximumSignificantDigits: 15 }).format(Number.MAX_VALUE) is '179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000'
 PASS Intl.NumberFormat('en').format(1234.567) is '1,234.567'

Modified: trunk/LayoutTests/js/script-tests/intl-numberformat.js (259369 => 259370)


--- trunk/LayoutTests/js/script-tests/intl-numberformat.js	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/LayoutTests/js/script-tests/intl-numberformat.js	2020-04-01 23:15:16 UTC (rev 259370)
@@ -317,7 +317,7 @@
 shouldBe("Intl.NumberFormat('en').format(Infinity)", "'∞'");
 shouldBe("Intl.NumberFormat('en').format(-Infinity)", "'-∞'");
 shouldBe("Intl.NumberFormat('en').format(0)", "'0'");
-shouldBe("Intl.NumberFormat('en').format(-0)", "'0'");
+shouldBe("Intl.NumberFormat('en').format(-0)", "'-0'");
 shouldBe("Intl.NumberFormat('en').format(Number.MIN_VALUE)", "'0'");
 shouldBe("Intl.NumberFormat('en', { maximumSignificantDigits: 15 }).format(Number.MAX_VALUE)", "'179,769,313,486,232,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000'");
 

Modified: trunk/Source/_javascript_Core/ChangeLog (259369 => 259370)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-01 23:15:16 UTC (rev 259370)
@@ -1,3 +1,17 @@
+2020-04-01  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        Intl.NumberFormat.prototype.format must preserve sign of -0
+        https://bugs.webkit.org/show_bug.cgi?id=209880
+
+        Reviewed by Keith Miller.
+
+        The spec changed here two years ago:
+        https://github.com/tc39/ecma402/pull/232
+
+        * runtime/IntlNumberFormat.cpp:
+        (JSC::IntlNumberFormat::formatNumber):
+        Do NOT throw away the sign of -0.
+
 2020-04-01  Justin Michaud  <jus...@justinmichaud.com>
 
         Delete IC incorrectly caches for proxies

Modified: trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp (259369 => 259370)


--- trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp	2020-04-01 23:03:30 UTC (rev 259369)
+++ trunk/Source/_javascript_Core/runtime/IntlNumberFormat.cpp	2020-04-01 23:15:16 UTC (rev 259370)
@@ -344,10 +344,6 @@
     if (!m_initializedNumberFormat)
         return throwTypeError(globalObject, scope, "Intl.NumberFormat.prototype.format called on value that's not an object initialized as a NumberFormat"_s);
 
-    // Map negative zero to positive zero.
-    if (!number)
-        number = 0.0;
-
     UErrorCode status = U_ZERO_ERROR;
     Vector<UChar, 32> buffer(32);
     auto length = unum_formatDouble(m_numberFormat.get(), number, buffer.data(), buffer.size(), nullptr, &status);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to