OffsetArrays.jl icon indicating copy to clipboard operation
OffsetArrays.jl copied to clipboard

Define array promotion rules

Open jishnub opened this issue 3 years ago • 1 comments

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]

jishnub avatar May 20 '22 18:05 jishnub

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.

codecov[bot] avatar May 20 '22 18:05 codecov[bot]

Not necessary anymore, as the change has been reverted

jishnub avatar Jan 02 '23 13:01 jishnub