JuliaArrays / StaticArrays.jl

Statically sized arrays for Julia
Other
763 stars 148 forks source link

broadcast! with non-static LHS broken on Julia master #385

Closed tkoolen closed 6 years ago

tkoolen commented 6 years ago
julia> using StaticArrays

julia> a = zeros(3, 3)
3×3 Array{Float64,2}:
 0.0  0.0  0.0
 0.0  0.0  0.0
 0.0  0.0  0.0

julia> b = ones(SMatrix{3, 3})
3×3 SArray{Tuple{3,3},Float64,2,9}:
 1.0  1.0  1.0
 1.0  1.0  1.0
 1.0  1.0  1.0

julia> a .= b
┌ Warning: Deprecated syntax `using the value of `.=``.
└ @ nothing none:0
ERROR: MethodError: Cannot `convert` an object of type Array{Float64,2} to an object of type Size
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:123
Stacktrace:
 [1] Size(::Array{Float64,2}) at ./deprecated.jl:472
 [2] broadcast! at /Users/twan/code/julia/RigidBodyDynamics/v0.7/StaticArrays/src/broadcast.jl:69 [inlined]
 [3] broadcast!(::typeof(identity), ::Array{Float64,2}, ::SArray{Tuple{3,3},Float64,2,9}) at ./broadcast.jl:444
 [4] top-level scope
andyferris commented 6 years ago

What... is that deprecation warning?

Thanks for the report.

fredrikekre commented 6 years ago

Likely a duplicate of https://github.com/JuliaLang/julia/issues/26516 Edit: The deprecation warning that is, not the failure :)

tkoolen commented 6 years ago

Yeah, the .= depwarn is rough. I'd be very surprised if that's still in place (at least at the repl, but even in general) upon release of 0.7. I'm imagining the uninitialized discussion on Discourse x10, all to support a pretty rare use case.

tkoolen commented 6 years ago

I'll try to fix this one right now. Let me know if somebody else is already working on a fix.