Run Aqua in tests; fix Bool conversions and rounding - #210
Open
ViralBShah wants to merge 1 commit into
Open
ViralBShah wants to merge 1 commit into
ViralBShah wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #210 +/- ##
=======================================
Coverage 97.13% 97.14%
=======================================
Files 2 2
Lines 593 595 +2
=======================================
+ Hits 576 578 +2
Misses 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Aqua found a method ambiguity between the generic (::Type{I<:Integer})(x::DecimalFloatingPoint)
constructor and Base.Bool(::Real), and a missing compat entry for Test. Fixing the ambiguity
surfaced related Bool bugs: DecXX(true) went through string parsing and failed, and
trunc/floor/ceil/round(Bool, x) either hit an ambiguity (Julia < 1.11) or threw
InexactError from Bool(10) in the generic integer path (Julia >= 1.11).
- Bool(x::DecimalFloatingPoint) with Base's semantics (0 -> false, 1 -> true, else InexactError)
- DecXX(x::Bool) via the Int32 path
- trunc/floor/ceil/round(Bool, x) via Int
- Test compat entry; Aqua added to the test target and run in runtests.jl
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014GD7jbSks8x6h6QThUrhk3
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.
Running Aqua on master reports two problems: a method ambiguity between the generic
(::Type{I<:Integer})(x::DecimalFloatingPoint)constructor andBase.Bool(::Real), and a missing[compat]entry forTest.Fixing the ambiguity surfaced a few related pre-existing
Boolbugs:Dec64(true)fell through to the string-parsing fallback and threwArgumentError: invalid number format true.trunc(Bool, x)/floor/ceil/round(Bool, x)were ambiguous with Base's(::Type{Bool}, ::AbstractFloat)methods on Julia < 1.11, and on 1.11+ they hit the generic integer path which constructsI(10)and throwsInexactError: Bool(10).Changes:
Base.Bool(x::DecimalFloatingPoint)with the same semantics asBool(::Real).DecXX(x::Bool)routed through the existingInt32constructor.trunc/floor/ceil/round(::Type{Bool}, x)defined viaInt.Test = "<0.0.1, 1"compat; Aqua added to the test target andAqua.test_allrun inruntests.jl.Tested locally on Julia 1.7 (x64), 1.9, 1.10 and 1.12; all pass including all 11 Aqua checks.
🤖 Generated with Claude Code
https://claude.ai/code/session_014GD7jbSks8x6h6QThUrhk3