JuliaArrays / OffsetArrays.jl

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

Define array promotion rules #288

Closed jishnub closed 1 year ago

jishnub commented 2 years ago

Fixes #273, but this will need to be tested extensively to avoid breakages. Better or more robust solutions are welcome!

This PR delegates the promote_type operation to the parent wherever possible, and wraps the OffsetArray type around the result.

After this:

julia> [ones(2), ones(2:3)]
2-element Vector{OffsetVector{Float64, Vector{Float64}}}:
 [1.0, 1.0]
 [1.0, 1.0]

julia> [OffsetArray(["a"], 2), OffsetArray([1], 3)]
2-element Vector{OffsetVector{T} where T}:
 ["a"]
 [1]
codecov[bot] commented 2 years ago

Codecov Report

Merging #288 (3a9c563) into master (5eeae03) will decrease coverage by 0.34%. The diff coverage is 80.00%.

@@            Coverage Diff             @@
##           master     #288      +/-   ##
==========================================
- Coverage   95.53%   95.19%   -0.35%     
==========================================
  Files           5        5              
  Lines         426      437      +11     
==========================================
+ Hits          407      416       +9     
- Misses         19       21       +2     
Impacted Files Coverage Δ
src/OffsetArrays.jl 96.87% <80.00%> (-0.60%) :arrow_down:

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 5eeae03...3a9c563. Read the comment docs.

jishnub commented 1 year ago

Not necessary anymore, as the change has been reverted