Skip to content

Commit b1aa4c0

Browse files
fix a few functions that now have static values
1 parent 5a314f9 commit b1aa4c0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-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 = "StaticArrayInterface"
22
uuid = "0d7ed370-da01-4f52-bd93-41d350b8b718"
3-
version = "1.2.0"
3+
version = "1.2.1"
44

55
[deps]
66
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/StaticArrayInterface.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,16 @@ An abstract trait that is used to determine how axes are combined when calling `
9595
"""
9696
abstract type BroadcastAxis end
9797

98-
@assume_effects :total function _find_first_true(isi::Tuple{Vararg{Bool, N}}) where {N}
98+
@assume_effects :total function _find_first_true(isi::Tuple{Vararg{Union{Bool, Static.StaticBool}, N}}) where {N}
9999
for i in 1:N
100-
getfield(isi, i) && return i
100+
x = getfield(isi, i)
101+
if (x isa Bool && x === true) || x isa Static.True
102+
return i
103+
end
101104
end
102105
return nothing
103106
end
104107

105-
_find_first_true(::Tuple{Static.True, Bool}) = 1
106-
107108
"""
108109
IndicesInfo{N}(inds::Tuple) -> IndicesInfo{N}(typeof(inds))
109110
IndicesInfo{N}(T::Type{<:Tuple}) -> IndicesInfo{N,pdims,cdims}()
@@ -218,11 +219,12 @@ struct IndicesInfo{Np, pdims, cdims, Nc}
218219
IndicesInfo(x::SubArray) = IndicesInfo{ndims(parent(x))}(typeof(x.indices))
219220
end
220221

221-
@inline function _map_splats(nsplat::Int, splat_index::Int, dims::Tuple{Vararg{Int}})
222+
@inline function _map_splats(nsplat::Int, splat_index::Int, dims::Tuple{Vararg{Union{Int,StaticInt}}})
222223
ntuple(length(dims)) do i
223224
i === splat_index ? (nsplat * getfield(dims, i)) : getfield(dims, i)
224225
end
225226
end
227+
226228
@inline function _accum_dims(csdims::NTuple{N, Int}, nd::NTuple{N, Int}) where {N}
227229
ntuple(N) do i
228230
nd_i = getfield(nd, i)

0 commit comments

Comments
 (0)