Skip to content

Conversation

@mtfishman
Copy link
Collaborator

@mtfishman mtfishman commented Nov 20, 2025

I found that similar calls such as:

using BlockArrays
r = blockedrange([2, 2])
similar(Array{Float64}, (r, r, r))

(with inputs of 3 or more blocked axes) lead to ambiguity errors between the StridedArray and AbstractArray versions which output BlockedArray and BlockArray respectively, this PR fixes that ambiguity by defining a more specialized similar method only for AbstractBlockedUnitRange inputs. The existing definitions accept mixtures of blocked, non-blocked, and integer dimensions which is more prone to ambiguities.

Related to #196 and #489.

I also noticed these definitions are not so friendly for GPU array types but that is a separate matter...

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.37%. Comparing base (7ebbea7) to head (9448261).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #494      +/-   ##
==========================================
- Coverage   94.52%   94.37%   -0.16%     
==========================================
  Files          19       19              
  Lines        1789     1812      +23     
==========================================
+ Hits         1691     1710      +19     
- Misses         98      102       +4     

☔ View full report in Codecov by Sentry.
📢 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 mtfishman merged commit ae21b37 into JuliaArrays:master Nov 20, 2025
17 of 18 checks passed
@mtfishman mtfishman deleted the mf/similar-ambiguity branch November 20, 2025 02:16
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