-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange loss of Type Specificity #156
Comments
I had a bit of a dig. This goes via In this specific case, a fix can be had in 0.5 by defining Base.promote_op{F<:FixedArray,T<:Number}(::typeof(.*), ::Type{F}, ::Type{T}) = similar_type(F, promote_type(eltype(F), T)) More generally, the following would probably mostly work: julia> using FixedSizeArrays
julia> Base.promote_op{Op,F<:FixedArray,T<:Number}(op::Op, ::Type{F}, ::Type{T}) = similar_type(F, Base.promote_op(op, eltype(F), T))
julia> Base.promote_op{Op,F<:FixedArray,T<:Number}(op::Op, ::Type{T}, ::Type{F}) = similar_type(F, Base.promote_op(op, T, eltype(F)))
julia> 1.0*view(Vec{3,Float64}[], 1:0)
0-element Array{FixedSizeArrays.Vec{3,Float64},1}
julia> view(Vec{3,Float64}[], 1:0)*1.0
0-element Array{FixedSizeArrays.Vec{3,Float64},1} I think the machinery in Base is somewhat different here in 0.5 vs 0.4. |
Yeah I keep adding definitions like that to fix the various corner cases :D |
Might you be able to get rid of the |
Output:
The text was updated successfully, but these errors were encountered: