Skip to content

feat(minor): Make fractionalDigitCount public - #8

Merged
hassila merged 2 commits into
mainfrom
fix/public-fractional-digit-count
Sep 21, 2026
Merged

hassila merged 2 commits into
mainfrom
fix/public-fractional-digit-count

Conversation

@hassila

@hassila hassila commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

FixedPointDecimal.fractionalDigitCount becomes public (it was @usableFromInline internal), with @inlinable since it is a constant.

Code that formats or parses FixedPointDecimal values from another module needs the number of fractional digits to size fraction lengths, quantums and exponents, and today has to hard-code 8. A downstream consumer that vendors these sources into a library-evolution module has carried exactly this one-line change as a local patch since the 2.2.0 vendoring; upstreaming it means the next re-vendor no longer reverts it (sc-38636). The vendored copy differs from upstream in nothing else beyond formatter output.

Nothing else changes: the storage layout, the arithmetic and the internal uses of the constant are untouched, and BasicTests already asserts the value is 8.

Verification: swift build and swift test on this branch, 634 tests in 18 suites passing. The CI failures on the first push are two pre-existing workflow defects that hit every PR in this repository and are fixed separately: the benchmark comparison step runs under bash -e, so any threshold deviation aborts the step before its exit-code mapping and reports an unknown failure (it has failed on all eight runs in the workflow's history), and the coverage export looks for FixedPointPackageTests.xctest although the package is named FixedPointDecimal and the swift:latest container has moved to 6.4, where no .xctest file is produced for a Swift Testing-only package. A local run of the benchmark comparison shows only wall-clock noise, including on the Foundation Decimal benchmarks this change cannot touch, and one 5% instruction deviation with a p50 to p75 spread wider than the difference.

Codex (gpt-6-astra) found nothing blocking in either pass; its two nits, a usage-oriented doc comment and a DocC topics entry, are taken. Its suggestion of an ordinary-import client compile test against a library-evolution build is not taken: that compile happens in the vendoring consumer, and this repository has no second module to host it.

🤖 Generated with Claude Code

Formatting and parsing code outside the module needs the number of fractional digits to size
fraction lengths, quantums and exponents, and had to hard-code 8 or keep a local patch of this
file. The accessor is a constant, so it is also @inlinable; the storage layout is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request changes the access level of fractionalDigitCount in FixedPointDecimal from internal to public and marks it as @inlinable. This allows external modules to access the fractional digit count directly for formatting and parsing. There are no review comments, and I have no feedback to provide.

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

…the DocC topics

Review feedback on #8: the doc comment states what the value is for rather than why it was made
public, and the DocC constants group links the newly public property.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@hassila
hassila merged commit e377f42 into main Sep 21, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants