Skip to content

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

Draft
sylvesterkaczmarek wants to merge 1 commit into
llnl:mainfrom
sylvesterkaczmarek:fix/group-compound-unit-powers
Draft

sylvesterkaczmarek wants to merge 1 commit into
llnl:mainfrom
sylvesterkaczmarek:fix/group-compound-unit-powers

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

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.

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

1 participant