Skip to content

Fix/3860 nested formatter precision - #4892

Open
way4sahil wants to merge 2 commits into
fmtlib:mainfrom
way4sahil:fix/3860-nested-formatter-precision
Open

Fix/3860 nested formatter precision#4892
way4sahil wants to merge 2 commits into
fmtlib:mainfrom
way4sahil:fix/3860-nested-formatter-precision

Conversation

@way4sahil

Copy link
Copy Markdown

Fixes #3860

Dynamic width and precision specifications inside nested_formatter now
resolve argument IDs against the enclosing format context.

This adds:

  • Context forwarding for nested formatters.
  • Dynamic width handling.
  • Named and explicit argument support.
  • Tests for dynamic width, precision, padding, and static formatting.
  • A ChangeLog entry.

@way4sahil
way4sahil requested a review from vitaut as a code owner August 23, 2026 10:31

@fallenmi fallenmi 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.

Requesting changes at exact head ee0b93c72d2ecd933d24997304bf6e6de2488a0a.

The dynamic-precision path itself works when the formatter uses the new nested(value, ctx) overload: my exact-base oracle (21d4cc15c8a2a3536aab5623258ba3b3dae573ce) reports argument not found, while this head produces (1.00, 2.00). The focused head test also passes (format-test --gtest_filter=format_test.nested_formatter, 1/1, 9.5 s including configure/build).

There are two attributable blockers on this head:

  1. The repository's g++-13 c++23 Release Shared job fails in format.h:4178: the new local alias using context = ... shadows the existing fmt::context, and the project promotes -Wshadow to an error. Please rename that alias (for example, nested_context_type).
  2. The clang-format job fails around the same specialization. I reproduced this with Apple clang-format 21 and the repository config: the exact base produces no diff, while the exact head rewrites lines 4171-4181. Please apply clang-format 21 to the touched code.

Please also drop unrelated commit d0d9adaf6ee72213ad2f9925b7056d5eb2890467 from this branch. Its C++20 module documentation change is already being reviewed separately in #4891 and is unrelated to the nested_formatter fix.

Disclosure: this review was prepared with Codex assistance; I verified the diff, exact SHAs, test outputs, and current CI logs before submitting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic precision for nested_formatter does not work

2 participants