Skip to content

Drop the AbstractNamedInteger <: Integer subtyping#172

Merged
mtfishman merged 4 commits into
mainfrom
mf/drop-namedinteger-integer
Jun 20, 2026
Merged

Drop the AbstractNamedInteger <: Integer subtyping#172
mtfishman merged 4 commits into
mainfrom
mf/drop-namedinteger-integer

Conversation

@mtfishman

@mtfishman mtfishman commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

Makes AbstractNamedInteger a standalone abstract type instead of <: Integer. A named integer is a tagged scalar, not a true integer: operations like i1 * i2 fuse names rather than multiply cleanly, mixed named and unnamed arithmetic has no well-defined meaning, and inherited Integer fallbacks risk silently dropping the name. The type keeps the explicit integer-like surface it actually needs (equality, hashing, the arithmetic it supports, ordering, show).

This also removes the named-to-plain-number conversion path (the Number constructor and convert) that let named and unnamed integers interoperate. That interoperation is what the standalone design deliberately drops, and a convert that silently discards the name is exactly the name loss being avoided. The one internal consumer, resolving begin and end to a plain index in to_index, now reads the underlying value with denamed, which is also how callers should get the plain integer from a named integer.

The element-type constraints that disambiguate named-range indexing (the BlockArrays getindex methods and the plain-Array indexing method) change from {<:Integer} to {<:AbstractNamedInteger}, since a named unit range's element type is a named integer, which is not an Integer.

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

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.44%. Comparing base (fd324eb) to head (37f4c58).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
- Coverage   73.46%   73.44%   -0.03%     
==========================================
  Files          21       21              
  Lines        1142     1141       -1     
==========================================
- Hits          839      838       -1     
  Misses        303      303              
Flag Coverage Δ
docs 22.78% <0.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

mtfishman and others added 3 commits June 19, 2026 20:26
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mtfishman mtfishman enabled auto-merge (squash) June 20, 2026 00:56
@mtfishman mtfishman merged commit 7bc5ad8 into main Jun 20, 2026
18 checks passed
@mtfishman mtfishman deleted the mf/drop-namedinteger-integer branch June 20, 2026 01:00
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