Skip to content

Commit 46db5c9

Browse files
committed
Add a simple test for this specific issue, and a fix to unwrap_broadcasted.
1 parent 596c163 commit 46db5c9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/broadcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ end
4242

4343
function unwrap_broadcasted(bc::Broadcasted{KeyedStyle{S}}) where {S}
4444
inner_args = map(unwrap_broadcasted, bc.args)
45-
Broadcasted{S}(bc.f, inner_args)
45+
Broadcasted{S}(bc.f, inner_args, axes(bc))
4646
end
4747
unwrap_broadcasted(x) = x
4848
unwrap_broadcasted(x::KeyedArray) = parent(x)

test/_basic.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,17 @@ end
259259
@test_throws Exception unify_keys((1:2,), ([3,4],))
260260

261261
end
262+
@testset "https://github.com/mcabbott/AxisKeys.jl/issues/128" begin
263+
using LinearAlgebra
264+
265+
# Really simple test that broadcasting with linalg array types works.
266+
v = rand(10)
267+
σ = wrapdims(v; time=-4:5)
268+
L = LowerTriangular(reshape(1.0:1.0:100, (10, 10)))
269+
σ .* L
270+
v .* L
271+
@test σ .* L v .* L
272+
end
262273
end
263274
@testset "bitarray" begin
264275

0 commit comments

Comments
 (0)