Skip to content

Commit

Permalink
help Julia with type inference by providing ntuple with Val (#1174)
Browse files Browse the repository at this point in the history
As per JuliaArrays/StaticArraysCore.jl#21

Bumped patch version to 1.6.1.
  • Loading branch information
nsajko authored Jul 13, 2023
1 parent b05454f commit 69c5ac9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "StaticArrays"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.6.0"
version = "1.6.1"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
8 changes: 4 additions & 4 deletions src/SArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ _cat_size(x::AbstractArray, i) = size(x, i)
_cat_sizes(x, dims) = ntuple(i -> _cat_size(x, i), dims)

function cat_any(::Val{maxdim}, ::Val{catdim}, args::Vector{Any}) where {maxdim,catdim}
szs = Dims{maxdim}[_cat_sizes(a, maxdim) for a in args]
szs = Dims{maxdim}[_cat_sizes(a, Val(maxdim)) for a in args]
out = Array{Any}(undef, check_cat_size(szs, catdim))
dims_before = ntuple(_ -> (:), catdim-1)
dims_after = ntuple(_ -> (:), maxdim-catdim)
dims_before = ntuple(_ -> (:), Val(catdim-1))
dims_after = ntuple(_ -> (:), Val(maxdim-catdim))
cat_any!(out, dims_before, dims_after, args)
end

Expand All @@ -104,7 +104,7 @@ end

@noinline cat_mismatch(j,sz,nsz) = throw(DimensionMismatch("mismatch in dimension $j (expected $sz got $nsz)"))
function check_cat_size(szs::Vector{Dims{maxdim}}, catdim) where {maxdim}
isempty(szs) && return ntuple(_ -> 0, maxdim)
isempty(szs) && return ntuple(_ -> 0, Val(maxdim))
sz = szs[1]
catsz = sz[catdim]
for i in 2:length(szs)
Expand Down

2 comments on commit 69c5ac9

@mateuszbaran
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/87433

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.6.1 -m "<description of version>" 69c5ac948cc43a30048945e59ee00415bf4f833d
git push origin v1.6.1

Please sign in to comment.