Skip to content

Commit

Permalink
Fixed #123, inner constructor ambiguous with error message constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Ferris committed Mar 24, 2017
1 parent 003c40f commit a0d6658
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/convert.jl
Original file line number Diff line number Diff line change
@@ -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[1][1][1])).")

@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?
Expand Down
7 changes: 7 additions & 0 deletions test/custom_types.jl
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a0d6658

Please sign in to comment.