Skip to content

fix: return Bool from isequal and isless with missing - #232

Open
jkrumbiegel wants to merge 1 commit into
JuliaPhysics:mainfrom
jkrumbiegel:jk/missing-isequal-isless
Open

jkrumbiegel wants to merge 1 commit into
JuliaPhysics:mainfrom
jkrumbiegel:jk/missing-isequal-isless

Conversation

@jkrumbiegel

Copy link
Copy Markdown
Contributor

🤖:


isequal and isless are supposed to always return a Bool (isequal(x, missing) is false, and isless sorts missing last), but for quantities both returned missing:

julia> isequal(25us"mg", missing)
missing

julia> findfirst(isequal(missing), [1us"mg", missing])
ERROR: TypeError: non-boolean (Missing) used in boolean context

The missing methods were added in #35 to resolve Aqua ambiguities, and isequal was added to the same loop in #85. They all copied the three-valued == behavior, which is only correct for == and <. Now isequal and isless return the same values as Base's Missing fallbacks.

isequal and isless are total predicates in Base: isequal(x, missing) is
false and isless sorts missing last. The disambiguation methods for
quantities returned missing for both, like == and <, which broke
findfirst(isequal(missing), ...), Dict keys and similar code.
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.16%. Comparing base (3d6b8ef) to head (a86927b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #232   +/-   ##
=======================================
  Coverage   99.16%   99.16%           
=======================================
  Files          23       24    +1     
  Lines        1320     1325    +5     
=======================================
+ Hits         1309     1314    +5     
  Misses         11       11           

☔ 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.

This branch has not been deployed

No deployments
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