Construct generic results via lohi/midrad#22
Merged
Conversation
`typemin`, `typemax`, `intersect` and `hull` built their result by calling the two-argument constructor `TN(lo, hi)`, which assumes the type is parametrized by its lower and upper span. A type parametrized some other way received its arguments under the wrong interpretation: for a midpoint and radius, `hull` read the upper bound as a radius, so hulling a value with itself was not even idempotent, and `typemin` produced a `NaN` midpoint from `Inf - Inf`. `intersect` and `hull` now use `lohi`, which is the interface's hook for building a value from a span. `typemin` and `typemax` use `midrad` with a zero radius; going through `lohi` would ask a midpoint-parametrized type to evaluate `Inf - Inf`. `MidRad` is a new test package parametrized by midpoint and radius. Every span assertion is run against both it and `Interval`, so generic code that silently assumes a lo/hi parametrization now fails the test suite; `Interval` alone cannot detect it. Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22 +/- ##
=======================================
Coverage 93.87% 93.87%
=======================================
Files 2 2
Lines 147 147
=======================================
Hits 138 138
Misses 9 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
typemin,typemax,intersectandhullbuilt their result by calling the two-argument constructorTN(lo, hi), which assumes the type is parametrized by its lower and upper span. A type parametrized some other way received its arguments under the wrong interpretation: for a midpoint and radius,hullread the upper bound as a radius, so hulling a value with itself was not even idempotent, andtypeminproduced aNaNmidpoint fromInf - Inf.intersectandhullnow uselohi, which is the interface's hook for building a value from a span.typeminandtypemaxusemidradwith a zero radius; going throughlohiwould ask a midpoint-parametrized type to evaluateInf - Inf.MidRadis a new test package parametrized by midpoint and radius. Every span assertion is run against both it andInterval, so generic code that silently assumes a lo/hi parametrization now fails the test suite;Intervalalone cannot detect it.Assisted-by: Claude Opus 4.8 noreply@anthropic.com