JuliaArrays / OffsetArrays.jl

Fortran-like arrays with arbitrary, zero or negative starting indices.
Other
198 stars 40 forks source link

Fix IdOffsetRange kwargs constructor given offset ranges #303

Closed jishnub closed 2 years ago

jishnub commented 2 years ago

On master

julia> import OffsetArrays: IdOffsetRange

julia> p = OffsetArrays.IdOffsetRange(1:3, 2)
IdOffsetRange(values=3:5, indices=3:5)

julia> IdOffsetRange(values=p.-2, indices=p)
IdOffsetRange(values=1:3, indices=5:7)

The issue here is that p .- 2 preserves its axes on broadcasting. May be fixed easily by stripping the axes.

After this PR

julia> IdOffsetRange(values=p.-2, indices=p)
IdOffsetRange(values=1:3, indices=3:5)
codecov[bot] commented 2 years ago

Codecov Report

Merging #303 (8fd3be3) into master (1493303) will increase coverage by 0.03%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #303      +/-   ##
==========================================
+ Coverage   96.38%   96.41%   +0.03%     
==========================================
  Files           5        5              
  Lines         442      446       +4     
==========================================
+ Hits          426      430       +4     
  Misses         16       16              
Impacted Files Coverage Δ
src/axes.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1493303...8fd3be3. Read the comment docs.

jishnub commented 2 years ago

Yes, it's a bugfix. I'll bump the patch version