MWE
julia> a = [1:7;];
julia> a[Base.IdentityUnitRange(3:4)] = 2:3
2:3
julia> a[Base.IdentityUnitRange(3:4)] .= 2:3
ERROR: DimensionMismatch: array could not be broadcast to match destination
Stacktrace:
[1] check_broadcast_shape
@ ./broadcast.jl:540 [inlined]
[2] check_broadcast_axes
@ ./broadcast.jl:543 [inlined]
[3] instantiate
@ ./broadcast.jl:284 [inlined]
[4] materialize!
@ ./broadcast.jl:871 [inlined]
[5] materialize!(dest::SubArray{Int64, 1, Vector{Int64}, Tuple{Base.IdentityUnitRange{UnitRange{Int64}}}, true}, bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(identity), Tuple{UnitRange{Int64}}})
@ Base.Broadcast ./broadcast.jl:868
[6] top-level scope
@ REPL[82]:1
Ideally, these two should be equivalent, and the setindex! should really only work if the RHS has the same indices.
MWE
Ideally, these two should be equivalent, and the
setindex!should really only work if the RHS has the same indices.