Skip to content

Run Aqua in tests; fix Bool conversions and rounding - #210

Open
ViralBShah wants to merge 1 commit into
masterfrom
aqua
Open

ViralBShah wants to merge 1 commit into
masterfrom
aqua

Conversation

@ViralBShah

Copy link
Copy Markdown
Member

Running Aqua on master reports two problems: 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 a few related pre-existing Bool bugs:

  • Dec64(true) fell through to the string-parsing fallback and threw ArgumentError: 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 constructs I(10) and throws InexactError: Bool(10).

Changes:

  • Base.Bool(x::DecimalFloatingPoint) with the same semantics as Bool(::Real).
  • DecXX(x::Bool) routed through the existing Int32 constructor.
  • trunc/floor/ceil/round(::Type{Bool}, x) defined via Int.
  • Test = "<0.0.1, 1" compat; Aqua added to the test target and Aqua.test_all run in runtests.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

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.14%. Comparing base (f085ba3) to head (d6ebe2a).
⚠️ Report is 6 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant