Skip to content

Commit 630cf6c

Browse files
authored
Relax construct_type recursion check. (#1133)
If `need_rewrap` return true than `x` would be re-wrapped before the next call.
1 parent 7ca6faa commit 630cf6c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "StaticArrays"
22
uuid = "90137ffa-7385-5640-81b9-e52037218182"
3-
version = "1.5.18"
3+
version = "1.5.19"
44

55
[deps]
66
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/convert.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const SizeEltypeAdaptable = Union{SArray, MArray, SHermitianCompact, SizedArray}
8686
function construct_type(::Type{SA}, x) where {SA<:SizeEltypeAdaptable}
8787
SA′ = adapt_eltype(adapt_size(SA, x), x)
8888
check_parameters(SA′)
89-
(x isa Tuple && SA === SA′) || return SA′
89+
(!need_rewrap(SA′, x) && x isa Tuple && SA === SA′) || return SA′
9090
error("Constructor for $SA is missing. Please file a bug.")
9191
end
9292

test/SVector.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,10 @@
127127
f = [1,2,3]
128128
@test f == @SVector [f[i] for i in 1:3]
129129
end
130+
131+
@testset "issue 1118" begin
132+
a = SVector{1}(1)
133+
@test SVector{1, Tuple{SVector{1, Int}, SVector{1, Int}}}((a,a)) === SVector{1}((a,a))
134+
@test SVector{1, NTuple}((a,a))[1] === (a,a)
135+
end
130136
end

0 commit comments

Comments
 (0)