Skip to content

Commit bc93479

Browse files
gostevehowardandyferris
authored andcommitted
Fix default constructor for SizedArray
I ran into this problem working on a project that uses StaticArrays. I don't know the StaticArrays codebase at all, so this may be wrong, but it has solved the problem for me. Before this patch: ``` julia> StaticArrays.SizedMatrix{Tuple{2,2}, Float64}() ERROR: MethodError: Cannot `convert` an object of type Type{Tuple{2,2}} to an object of type Array{Float64,2} This may have arisen from a call to the constructor Array{Float64,2}(...), since type constructors fall back to convert methods. Stacktrace: [1] Type at /home/steve/.julia/v0.6/StaticArrays/src/SizedArray.jl:23 [inlined] [2] StaticArrays.SizedArray{Tuple{2,2},Float64,2,M} where M() at /home/steve/.julia/v0.6/StaticArrays/src/SizedArray.jl:31 ``` After this patch: ``` julia> StaticArrays.SizedMatrix{Tuple{2,2}, Float64}() 2×2 StaticArrays.SizedArray{Tuple{2,2},Float64,2,2}: 6.91502e-310 6.91504e-310 6.91504e-310 0.0 ``` My julia: ``` _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_) | Documentation: https://docs.julialang.org _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.6.0-pre.beta.338 (2017-04-26 15:52 UTC) _/ |\__'_|_|_|\__'_| | Commit 8e12b77 (2 days old master) |__/ | x86_64-pc-linux-gnu ```
1 parent aa56069 commit bc93479

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SizedArray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ immutable SizedArray{S <: Tuple, T, N, M} <: StaticArray{S, T, N}
2020
end
2121

2222
function (::Type{SizedArray{S, T, N, M}}){S, T, N, M}()
23-
new{S, T, N, M}(Array{T, M}(S))
23+
new{S, T, N, M}(Array{T, M}(S.parameters...))
2424
end
2525
end
2626

0 commit comments

Comments
 (0)