Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/convert.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# this covers most conversions and "statically-sized reshapes"
@inline convert(::Type{SA}, sa::StaticArray) where {SA<:StaticArray} = SA(Tuple(sa))
@inline convert(::Type{SA}, sa::StaticArray) where {SA<:Scalar} = SA((sa[],)) # disambiguation
@inline convert(::Type{SA}, sa::SA) where {SA<:StaticArray} = sa
@inline convert(::Type{SA}, x::Tuple) where {SA<:StaticArray} = SA(x) # convert -> constructor. Hopefully no loops...

Expand Down
6 changes: 3 additions & 3 deletions test/ambiguities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

const allowable_ambiguities =
if VERSION < v"1.1"
4
3
elseif VERSION < v"1.2"
2
else
1
else
0
end

@test length(detect_ambiguities(Base, LinearAlgebra, StaticArrays)) <= allowable_ambiguities
4 changes: 4 additions & 0 deletions test/convert.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ end # testset
# Issue #651
@testinf SVector{0,Float64}(Any[]) === SVector{0,Float64}()
@testinf SVector{0,Float64}(Int8[]) === SVector{0,Float64}()

# PR #808
@test Scalar{Int}[SVector{1,Int}(3), SVector{1,Float64}(2.0)] == [Scalar{Int}(3), Scalar{Int}(2)]
@test Scalar[SVector{1,Int}(3), SVector{1,Float64}(2.0)] == [Scalar{Int}(3), Scalar{Float64}(2.0)]
end