Skip to content

Group compound user-defined names in inverse and power formatting - #472

Merged
phlptp merged 1 commit into
llnl:mainfrom
sylvesterkaczmarek:fix/group-compound-unit-powers
Oct 1, 2026
Merged

phlptp merged 1 commit into
llnl:mainfrom
sylvesterkaczmarek:fix/group-compound-unit-powers

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Fixes #471.

Group user-defined names containing *, /, or ^ when exact-name lookup is used for an inverse, square, or cube. For example, the inverse of a unit registered as m/s was rendered as 1/m/s, which parses back with different dimensions. The grouped form is 1/(m/s).

Direct registered-name output and built-in names are unchanged. No public API or parser changes. Two regression tests cover 20 compound-name round trips, direct-name preservation, and unchanged atomic-name formatting.

Validation with Apple Clang 21 and CMake 4.3.2 on macOS arm64:

  • Against unchanged main (4ac3665), the compound-name regression reports 19 failed round-trip assertions; the atomic-name control passes.
  • With the fix, all 19 user-defined-unit tests pass, including both new tests.
  • Full build and CTest suite: 24/24 pass.
  • Repository-pinned clang-format 23.1.1 checks and git diff --check pass.

Python bindings and other operating systems were not tested locally. The change is limited to the formatter's exact inverse/square/cube lookup paths.

@sylvesterkaczmarek
sylvesterkaczmarek marked this pull request as ready for review September 26, 2026 22:59
@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor Author

This has been open for about 11 days with no maintainer feedback. The branch is current, mergeable, and has no current failing checks. Could a maintainer review it when convenient?

@phlptp

phlptp commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

looks good, thank you

@phlptp
phlptp merged commit e71a1e2 into llnl:main Oct 1, 2026
55 of 63 checks passed
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.

Compound user-defined names lose grouping in inverses and powers

2 participants