Release 0.2.0: fallible numeric conversions and chained-expression fixes - #29
Merged
Conversation
- Replace the panicking From<Number> for i32/i64/i128/f64 with fallible TryFrom returning a ConversionError; keep From<Number> for BigInt but make it exact (truncate the rational toward zero instead of round-tripping through f64). - Fix a trailing ';' reporting a spurious malformed-expression error after the assignment side-effect had already taken place; return the last segment's value and reject malformed chained segments. - Remove the unused, internally-panicking BitXor implementation for Number. - Grow the test suite from 36 to 64 tests: fallible/exact conversions, rounding on negatives, power edge cases, domain errors, variable case-insensitivity, chained assignment, square/mixed brackets, whitespace, decimal-literal parsing, Number Display and ConversionError messages. - Bump version to 0.2.0 and document the breaking change in the README.
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
Release 0.2.0. Makes numeric conversions fallible instead of panicking, fixes chained-expression handling, and grows the test suite from 36 to 64 tests.
Breaking change
From<Number>fori32/i64/i128/f64panicked on out-of-range or non-finite values. It is replaced byTryFrom<Number>, which returns aConversionError. Callers doingi64::from(n)must move toi64::try_from(n)?.From<Number> for BigIntis kept but is now exact: it truncates the rational toward zero instead of round-tripping throughf64, so large values no longer lose precision.Fixes
;reported a spurious malformed-expression error after the assignment side-effect had already been applied. Chained expressions now return the last segment's value, and genuinely malformed segments are rejected.BitXorimplementation forNumber, which panicked internally.Tests
36 → 64 tests, covering fallible/exact conversions, rounding on negatives, power edge cases, domain errors, variable case-insensitivity, chained assignment, square/mixed brackets, whitespace handling, decimal-literal parsing, and the
NumberDisplay/ConversionErrormessages.Verification
cargo testpasses locally: 28 integration tests, 31 unit tests, 5 doc-tests, 0 failures.Summary by cubic
Release 0.2.0 makes numeric conversions from
Numberfallible and fixes;-chained expressions to return the last segment’s value. It also removes a panickingBitXorand expands test coverage.Migration
into()calls withtry_into()/TryFromand handleConversionError(e.g.let x: i64 = n.try_into()?;) fori32,i64,i128, andf64.From<Number> for BigIntstays, and is now exact: it truncates toward zero without anf64round-trip.Bug Fixes
;returns the last segment’s value; malformed segments now error; assignment side-effects and reported values are consistent.BitXoronNumberthat could panic.Written for commit d4e035d. Summary will update on new commits.