Fix NumberFormat digit option resolution#679
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📝 WalkthroughWalkthroughThis PR introduces rounding priority support and migrates number formatting to use ICU's skeleton-based ChangesRounding Priority & Skeleton-Based Number Formatting
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Suite TimingTest Runner (interpreted: 9,788 passed; bytecode: 9,788 passed)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Test runner worker shutdown frees thread-local heaps in bulk; that shutdown reclamation is not counted as GC collections or collected objects.
Benchmarks (interpreted: 407; bytecode: 407)
MemoryGC rows aggregate the main thread plus all worker thread-local GCs. Benchmark runner performs explicit between-file collections, so collection and collected-object counts can be much higher than the test runner.
Measured on ubuntu-latest x64. |
Benchmark Results407 benchmarks Interpreted: 🟢 191 improved · 🔴 41 regressed · 175 unchanged · avg +5.2% arraybuffer.js — Interp: 🟢 4, 🔴 2, 8 unch. · avg +1.3% · Bytecode: 🟢 9, 5 unch. · avg +5.7%
arrays.js — Interp: 🟢 14, 5 unch. · avg +8.8% · Bytecode: 🟢 18, 1 unch. · avg +14.7%
async-await.js — Interp: 🟢 1, 5 unch. · avg +1.8% · Bytecode: 🟢 5, 1 unch. · avg +7.3%
async-generators.js — Interp: 2 unch. · avg +1.8% · Bytecode: 🟢 1, 1 unch. · avg +7.7%
base64.js — Interp: 🟢 2, 🔴 7, 1 unch. · avg -5.3% · Bytecode: 🟢 2, 🔴 7, 1 unch. · avg -0.3%
classes.js — Interp: 🟢 6, 🔴 4, 21 unch. · avg +0.5% · Bytecode: 🟢 16, 15 unch. · avg +3.6%
closures.js — Interp: 🟢 4, 7 unch. · avg +2.9% · Bytecode: 🟢 9, 2 unch. · avg +6.8%
collections.js — Interp: 🟢 4, 8 unch. · avg +1.6% · Bytecode: 🟢 12 · avg +10.7%
csv.js — Interp: 🟢 13 · avg +11.4% · Bytecode: 🟢 13 · avg +10.0%
destructuring.js — Interp: 🟢 12, 10 unch. · avg +3.5% · Bytecode: 🟢 22 · avg +7.8%
fibonacci.js — Interp: 🟢 1, 7 unch. · avg +0.9% · Bytecode: 🟢 8 · avg +8.7%
float16array.js — Interp: 🟢 23, 9 unch. · avg +8.5% · Bytecode: 🟢 22, 🔴 2, 8 unch. · avg +4.7%
for-of.js — Interp: 🟢 5, 2 unch. · avg +3.1% · Bytecode: 🟢 7 · avg +8.4%
generators.js — Interp: 🟢 2, 🔴 1, 1 unch. · avg +1.4% · Bytecode: 🟢 4 · avg +6.0%
iterators.js — Interp: 🟢 8, 🔴 5, 29 unch. · avg +1.0% · Bytecode: 🟢 32, 10 unch. · avg +5.7%
json.js — Interp: 🟢 12, 🔴 1, 7 unch. · avg +4.4% · Bytecode: 🟢 18, 2 unch. · avg +6.8%
jsx.jsx — Interp: 🟢 8, 13 unch. · avg +1.8% · Bytecode: 🟢 18, 3 unch. · avg +6.7%
modules.js — Interp: 🟢 8, 1 unch. · avg +8.8% · Bytecode: 🟢 9 · avg +9.4%
numbers.js — Interp: 🟢 9, 2 unch. · avg +6.8% · Bytecode: 🟢 11 · avg +9.1%
objects.js — Interp: 🟢 2, 5 unch. · avg +2.9% · Bytecode: 🟢 6, 1 unch. · avg +5.8%
promises.js — Interp: 🟢 6, 6 unch. · avg +2.2% · Bytecode: 🟢 11, 1 unch. · avg +7.4%
regexp.js — Interp: 🟢 4, 🔴 6, 1 unch. · avg -2.1% · Bytecode: 🟢 4, 🔴 6, 1 unch. · avg -3.2%
strings.js — Interp: 🟢 10, 🔴 1, 8 unch. · avg +3.6% · Bytecode: 🟢 19 · avg +8.5%
tsv.js — Interp: 🟢 9 · avg +12.8% · Bytecode: 🟢 8, 1 unch. · avg +6.1%
typed-arrays.js — Interp: 🟢 10, 🔴 4, 8 unch. · avg +8.2% · Bytecode: 🟢 19, 3 unch. · avg +27.8%
uint8array-encoding.js — Interp: 🟢 12, 6 unch. · avg +41.6% · Bytecode: 🟢 2, 🔴 10, 6 unch. · avg -24.7%
weak-collections.js — Interp: 🟢 2, 🔴 10, 3 unch. · avg -5.8% · Bytecode: 🟢 14, 1 unch. · avg +33.2%
Deterministic profile diffDeterministic profile diff: no significant changes. Measured on ubuntu-latest x64. Benchmark ranges compare cached main-branch min/max ops/sec with the PR run; overlapping ranges are treated as unchanged noise. Percentage deltas are secondary context. |
test262 Conformance
Areas closest to 100%
Per-test deltas (+29 / -0)Newly passing (29):
Steady-state failures are non-blocking; regressions vs the cached main baseline (lower total pass count, or any PASS → non-PASS transition) fail the conformance gate. Measured on ubuntu-latest x64, bytecode mode. Areas grouped by the first two test262 path components; minimum 25 attempted tests, areas already at 100% excluded. Δ vs main compares against the most recent cached |
23ba436 to
26347d7
Compare
26347d7 to
26ba078
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
source/shared/IntlICU.pas (1)
78-78: 💤 Low valuePotentially unused
Mathunit import
source/shared/IntlICU.pashasMathin itsusesclause, but there are noMath.-qualified calls and no usage of Math-specific functions likeMax,Min,Power,Floor,Ceil, etc. The only matches areSystem.Roundand unqualifiedAbs/Trunc, which can come fromSystem. RemoveMathif those are the only needs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@source/shared/IntlICU.pas` at line 78, The uses clause currently includes the Math unit but the file (IntlICU.pas) does not call any Math-qualified identifiers; remove "Math" from the uses clause in the unit declaration to avoid an unused import, then compile to confirm no missing references; if any Math functions (e.g., Max, Min, Power, Floor, Ceil) are actually used unqualified, either qualify them with System. or re-add/import only the needed functions instead of the whole Math unit; ensure symbols like Round, Abs, Trunc referenced in the file resolve from System or other units after the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@source/units/Goccia.Values.IntlNumberFormat.pas`:
- Around line 148-154: The new Pascal identifiers violate the repo naming rule
by using PascalCase; rename functions CompactDisplayStringToEnum and
RoundingPriorityStringToEnum and variables CurrDigits, MinimumFractionDefault
(and the other identifiers referenced at lines ~200-208 and ~513-516) to
camelCase (e.g., compactDisplayStringToEnum, roundingPriorityStringToEnum,
currDigits, minimumFractionDefault), update their declarations and all
call-sites/usages in this unit to the new names, and run a quick compile to
catch any missed references.
- Around line 587-601: The current gating on FNotation prevents currency digit
defaults from being applied for non-standard notations; update the branch around
the FStyle = 'currency' check so that when FStyle = 'currency' you always call
TryGetCurrencyInfo(FLocale, FCurrency, CurrSymbol, CurrNarrow, CurrDigits)
(falling back to CurrDigits := 2 on failure) and assign MinimumFractionDefault
:= CurrDigits and MaximumFractionDefault := CurrDigits regardless of FNotation,
then let any later compact/scientific/engineering-specific overrides apply;
modify the code paths that currently set
MinimumFractionDefault/MaximumFractionDefault based on FNotation so they no
longer bypass the currency-derived defaults for FCurrency.
---
Nitpick comments:
In `@source/shared/IntlICU.pas`:
- Line 78: The uses clause currently includes the Math unit but the file
(IntlICU.pas) does not call any Math-qualified identifiers; remove "Math" from
the uses clause in the unit declaration to avoid an unused import, then compile
to confirm no missing references; if any Math functions (e.g., Max, Min, Power,
Floor, Ceil) are actually used unqualified, either qualify them with System. or
re-add/import only the needed functions instead of the whole Math unit; ensure
symbols like Round, Abs, Trunc referenced in the file resolve from System or
other units after the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4a2d441a-a15f-40ea-a5af-d071dcc26b0a
📒 Files selected for processing (6)
source/shared/IntlICU.passource/shared/IntlTypes.passource/units/Goccia.Values.IntlNumberFormat.pastests/built-ins/Intl/NumberFormat/prototype/format.jstests/built-ins/Intl/NumberFormat/prototype/formatRange.jstests/built-ins/Intl/NumberFormat/prototype/resolvedOptions.js
Summary
Intl.NumberFormatdigit option resolution for one-sided currency fraction bounds so missing bounds use currency-specific defaults.autoroundingPriority.format(),formatToParts(),formatRange(), andformatRangeToParts()through ICU NumberFormatter skeletons so ICU owns rounding modes, rounding increments, sign display, and mixed fraction/significant precision consistently.resolvedOptions(),format(), andformatRange()regressions, including mixedroundingPriority, negative zero sign display, significant digits, and largeroundingIncrementcoverage.Testing
Additional verification run locally:
./format.pas --check./build.pas testrunner loaderbare./build/GocciaTestRunner tests/built-ins/Intl/NumberFormat --asi --unsafe-ffi --no-progressbun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/format/format-rounding-mode-*.js' --output /tmp/goccia-test262-rounding-mode.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/format/format-fraction-digits-precision.js' --output /tmp/goccia-test262-fraction-digits-precision.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/format/format-significant-digits.js' --output /tmp/goccia-test262-significant-digits.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/format/format-rounding-priority-*' --output /tmp/goccia-test262-rounding-priority.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/test-option-roundingPriority-mixed-options.js' --output /tmp/goccia-test262-rounding-priority-mixed.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/format/format-rounding-increment-*' --output /tmp/goccia-test262-rounding-increment.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/format/signDisplay-rounding.js' --output /tmp/goccia-test262-sign-display-rounding.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/formatRange/*.js' --output /tmp/goccia-test262-format-range-only.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/prototype/formatRangeToParts/*.js' --output /tmp/goccia-test262-format-range-parts.json --jobs=2bun scripts/run_test262_suite.ts --suite-dir /tmp/goccia-test262-d0c1b4555b03dd404873fd6422a4b5da00136500 --filter 'intl402/NumberFormat/**/*.js' --output /tmp/goccia-test262-numberformat-all.json --jobs=2(subtree has expected pre-existing failures; the rounding regression files above pass)./build/GocciaTestRunner tests --asi --unsafe-ffi --no-progress