Repository navigation
Refuse install_unit() before anything is mapped - #447
Closed
vorpalvorpal wants to merge 2 commits into
Closed
vorpalvorpal wants to merge 2 commits into
vorpalvorpal wants to merge 2 commits into
Conversation
A refused install_unit() used to leave the new symbol or name mapped to the existing unit. remove_unit() on that leftover then unmapped the existing unit's own symbol or name, so that e.g. degree lost its symbol for the rest of the session. install_unit() now runs every check first: the unit must not already have another symbol or name, and no symbol or name may belong to a different unit. The messages are the ones raised before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RzNVuCMZyYuDk4M1NMkB5Z
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RzNVuCMZyYuDk4M1NMkB5Z
Member
|
Thanks a lot for this, @vorpalvorpal, and for the very clear reproducible example in #448! Looking into it, we found several related issues in how units are installed and removed (refusals leaving partial mappings depending on the unit's encodings, and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #448.
A refused
install_unit()leaves the new symbol or name mapped to the existing unit, andremove_unit()on that leftover then unmaps the existing unit's own symbol or name:ud_map_symbols()maps each symbol to the unit and only then callsut_map_unit_to_symbol(), which is the step that fails;ud_map_names()has the same order.This PR makes
install_unit()check everything before it maps anything. A newud_check_free(symbol, name, ut_unit)refuses whenThe messages are the ones raised today; they now come before any mapping, so a refused call leaves nothing to remove. Nothing changes for calls that succeed.
The new test covers a refused symbol, a refused name, a refused name with a symbol in the same call, and a refused later symbol in a vector. It fails on
mainand passes here. The suite passes onmainat a823fef built against udunits 2.2.28 (macOS arm64, R 4.4.3): 118 tests, 0 failing, 6 skipped.🤖 Generated with Claude Code
https://claude.ai/code/session_01RzNVuCMZyYuDk4M1NMkB5Z