Skip to content

Range patterns do not match missing - #137

Open
quinnj-bot[bot] wants to merge 2 commits into
mainfrom
claude/range-pattern-missing
Open

quinnj-bot[bot] wants to merge 2 commits into
mainfrom
claude/range-pattern-missing

Conversation

@quinnj-bot

@quinnj-bot quinnj-bot Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Why

The docs say a constant range pattern such as 1:10 "matches values in that range", and their num_match('c') example shows a non-number falling through to the _ case. A missing input threw instead:

@match missing begin
    1:3 => 1
    _   => 2
end
# ERROR: TypeError: non-boolean (Missing) used in boolean context

What changed

Range patterns test i in r, and missing in 1:3 is missing. The generated code used that value as a Bool. The range test now treats missing as "not in the range". All range patterns, in @match, @ismatch and @match pattern = value, go through this one method.

No issue was filed. I found this while building a differential test harness for @match.

Verification

  • The new testset (first commit) fails on main with the TypeError above and passes with the fix.
  • Pkg.test() on Julia 1.12.6: 1063 passed, 5 broken (main: 1057 passed, the same 5 broken).
  • All five fixes from this bug hunt applied together also pass on Julia 1.10.11 and 1.14.0-alpha2 (1090 passed each).
  • CI: every job passes except Julia 1.9 and 1.10.2, which stop before running tests on the current Ubuntu runner (libopenlibm.so: cannot enable executable stack). PR Fix @match on 32-bit Julia (hash seeds typed as UInt64) #134 shows the same failure; this PR does not touch CI.

Review notes

  • Membership still uses in (==), so -0.0 still matches 0:1, as before.
  • The other constant tests use isequal or occursin, which always return a Bool. Guards are user code and keep their current behavior.

🤖 Generated with Claude Code

quinnj and others added 2 commits November 19, 2026 05:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
missing in 1:3 is missing, which threw a TypeError in the generated
boolean test instead of falling through to the next case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.38%. Comparing base (f26639b) to head (12245b6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #137   +/-   ##
=======================================
  Coverage   99.38%   99.38%           
=======================================
  Files          12       12           
  Lines        1132     1132           
=======================================
  Hits         1125     1125           
  Misses          7        7           

☔ 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