diff --git a/src/convert.jl b/src/convert.jl index 57778f925..f70d755e7 100644 --- a/src/convert.jl +++ b/src/convert.jl @@ -1,4 +1,4 @@ -(::Type{SA})(x::Tuple) where {SA <: StaticArray} = error("No precise constructor for $SA found. Length of input was $(length(x)).") +(::Type{SA})(x::Tuple{Tuple{Tuple{<:Tuple}}}) where {SA <: StaticArray} = error("No precise constructor for $SA found. Length of input was $(length(x)).") @inline (::Type{SA})(x...) where {SA <: StaticArray} = SA(x) @inline (::Type{SA})(a::AbstractArray) where {SA <: StaticArray} = convert(SA, a) # Is this a good idea? diff --git a/test/custom_types.jl b/test/custom_types.jl new file mode 100644 index 000000000..251779a5a --- /dev/null +++ b/test/custom_types.jl @@ -0,0 +1,7 @@ +@testset "Custom types" begin + # Issue 123 + @eval (struct MyType{N, T} <: StaticVector{T} + data::NTuple{N, T} + end) + @test (MyType(3, 4) isa MyType{2, Int}) +end diff --git a/test/runtests.jl b/test/runtests.jl index 34c28cdfc..addd19c38 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -10,6 +10,7 @@ using Base.Test include("MArray.jl") include("FieldVector.jl") include("Scalar.jl") + include("custom_types.jl") include("core.jl") include("abstractarray.jl")