fix(coordinates): consistent leading-zero handling, safe intersection, type coercion#104
Draft
HCookie wants to merge 1 commit into
Draft
fix(coordinates): consistent leading-zero handling, safe intersection, type coercion#104HCookie wants to merge 1 commit into
HCookie wants to merge 1 commit into
Conversation
…, type coercion - Fix leading-zero detection to be consistent across multi-value strings (e.g. '0600/1200' stays as strings, not parsed as integers) - Implement Mixed coordinates to_string() (was todo!()) - Fix intersect() to return Empty instead of panicking on cross-type or empty operands - Add type coercion between Strings and Integers when extending coordinates (avoids spurious Mixed variants when merging '1' with 1) - Add helper functions wrap_ints/wrap_strs to return Empty for zero-length results - Add comprehensive unit tests for intersection edge cases
This was referenced Jun 23, 2026
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.
Summary
Fixes correctness issues in the coordinate system that caused panics and data corruption during merge operations.
Changes
Leading-zero consistency
0600/1200), if any value has a leading zero, all are kept as strings. Previously each value was checked independently, causing inconsistent typing within a single coordinate set.Mixed coordinates
to_string()Mixedvariant'sto_string()method (wastodo!()).Safe intersection
intersect()now returnsEmptyinstead of panicking on cross-type or empty operands.wrap_ints/wrap_strshelpers to returnEmptyfor zero-length intersection results.Type coercion on extend
StringswithIntegers(or vice versa), attempts coercion before falling back toMixed. This avoids spuriousMixedvariants when merging e.g."1"with1.Tests
Part of the split from #102.