291291Base. @propagate_inbounds Base. getindex (A:: WrapArray , i:: Integer... ) = A. data[i... ]
292292Base. @propagate_inbounds Base. setindex! (A:: WrapArray , v:: Any , i:: Integer... ) = setindex! (A. data, v, i... )
293293Base. size (A:: WrapArray ) = size (A. data)
294+ Base. axes (A:: WrapArray ) = axes (A. data)
294295Broadcast. BroadcastStyle (:: Type{WrapArray{T,N,P}} ) where {T,N,P} = Broadcast. BroadcastStyle (P)
295296StaticArrays. isstatic (A:: WrapArray ) = StaticArrays. isstatic (A. data)
296297StaticArrays. Size (:: Type{WrapArray{T,N,P}} ) where {T,N,P} = StaticArrays. Size (P)
@@ -302,10 +303,14 @@ end
302303 data = (1 , 2 )
303304 for T in (SVector{2 }, MVector{2 })
304305 a = T (data)
305- b = WrapArray (a)
306- @test @inferred (b .+ a) isa T
307- @test @inferred (b .+ b) isa T
308- @test @inferred (b .+ (1 , 2 )) isa T
309- @test b .+ a == b .+ b == a .+ a
306+ for b in (WrapArray (a), WrapArray (a' ))
307+ @test @inferred (b .+ a) isa T
308+ @test @inferred (b .+ b) isa T
309+ @test @inferred (b .+ (1 , 2 )) isa T
310+ @test @inferred (b .+ a' ) isa StaticMatrix
311+ @test @inferred (a' .+ b) isa StaticMatrix
312+ # @test @inferred(b' .+ a') isa StaticMatrix # Adjoint doesn't propagate style
313+ @test b .+ a == b .+ b == a .+ a
314+ end
310315 end
311316end
0 commit comments