Skip to content

Commit 1b5a994

Browse files
aafsarmateuszbaran
andauthored
Fix missing tuple wrapper in sacollect (#1153)
* Fix missing tuple wrapper in sacollect * version bump --------- Co-authored-by: Mateusz Baran <mateuszbaran89@gmail.com>
1 parent f6e5db2 commit 1b5a994

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
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.20"
3+
version = "1.5.21"
44

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

src/SArray.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ shape_string(inds::CartesianIndex) = join(Tuple(inds), '×')
2424
iter = :(iterate(gen,st))
2525
end
2626
push!(stmts, :($iter === nothing || generator_too_long_error($inds)))
27-
push!(stmts, :(SA($(args...))))
27+
push!(stmts, :(SA(($(args...),))))
2828
Expr(:block, stmts...)
2929
end
3030
"""
@@ -92,7 +92,7 @@ function cat_any!(out, dims_before, dims_after, args::Vector{Any})
9292
@views for arg in args
9393
len = _cat_size(arg, catdim)
9494
dest = out[dims_before..., i+1:i+len, dims_after...]
95-
if arg isa AbstractArray
95+
if arg isa AbstractArray
9696
copyto!(dest, arg)
9797
else
9898
dest[] = arg
@@ -171,7 +171,7 @@ function static_array_gen(::Type{SA}, @nospecialize(ex), mod::Module) where {SA}
171171
rngs = Any[Core.eval(mod, ex.args[i+1].args[2]) for i = 1:n_rng]
172172
exprs = (:(f($(j...))) for j in Iterators.product(rngs...))
173173
return quote
174-
let
174+
let
175175
f($(escall(rng_args)...)) = $(esc(ex.args[1]))
176176
$SA{$Tuple{$(size(exprs)...)}}($tuple($(exprs...)))
177177
end
@@ -190,7 +190,7 @@ function static_array_gen(::Type{SA}, @nospecialize(ex), mod::Module) where {SA}
190190
rngs = Any[Core.eval(mod, ex.args[i+1].args[2]) for i = 1:n_rng]
191191
exprs = (:(f($(j...))) for j in Iterators.product(rngs...))
192192
return quote
193-
let
193+
let
194194
f($(escall(rng_args)...)) = $(esc(ex.args[1]))
195195
$SA{$Tuple{$(size(exprs)...)},$T}($tuple($(exprs...)))
196196
end
@@ -236,7 +236,7 @@ It supports:
236236
237237
2. comprehensions
238238
!!! note
239-
The range of a comprehension is evaluated at global scope by the macro, and must be
239+
The range of a comprehension is evaluated at global scope by the macro, and must be
240240
made of combinations of literal values, functions, or global variables.
241241
242242
3. initialization functions

test/SVector.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
@test SVector{0,Int}().data === ()
2525
@test SVector{3,Int}(i for i in 1:3).data === (1,2,3)
2626
@test SVector{3,Float64}(i for i in 1:3).data === (1.0,2.0,3.0)
27+
@test SVector{1}(SVector(SVector(1.0), SVector(2.0))[j] for j in 1:1) == SVector((SVector(1.0),))
2728
@test_throws Exception SVector{3}(i for i in 1:2)
2829
@test_throws Exception SVector{3}(i for i in 1:4)
2930
@test_throws Exception SVector{3,Int}(i for i in 1:2)

0 commit comments

Comments
 (0)