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
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.9.20"
version = "1.9.21"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
3 changes: 2 additions & 1 deletion src/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ end

# FIXME: This always assumes one-based linear indexing and that subtypes of StaticArray
# don't overload iterate
@inline function Base.rest(a::StaticArray{S}, (_, i) = (nothing, 0)) where {S}
@inline function Base.rest(a::StaticArray{S}, state = (nothing, 0)) where {S}
i = state isa Integer ? state - 1 : state[2]
newlen = tuple_prod(S) - i
return similar_type(typeof(a), Size(newlen))(Base.rest(Tuple(a), i + 1))
end
Expand Down
2 changes: 1 addition & 1 deletion src/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ struct StaticIndexing{I}
end
unwrap(i::StaticIndexing) = i.ind

function Base.to_indices(A, I::Tuple{Vararg{Union{Integer, CartesianIndex, StaticArray{<:Tuple,Int}}}})
function Base.to_indices(A, I::Tuple{Vararg{Union{Integer, CartesianIndex, StaticArray{<:Tuple,<:Integer}}}})
inds = to_indices(A, axes(A), I)
return map(StaticIndexing, inds)
end
Expand Down
42 changes: 37 additions & 5 deletions test/testutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ Test.record(ts::ErrorCounterTestSet, ::Test.Pass) = (ts.passcount += 1)
Test.record(ts::ErrorCounterTestSet, ::Test.Error) = (ts.errorcount += 1)
Test.record(ts::ErrorCounterTestSet, ::Test.Fail) = (ts.failcount += 1)

@static if VERSION >= v"1.13"
function _test_inlined_llvm(arginfo::InteractiveUtils.ArgInfo)
params = Base.CodegenParams(safepoint_on_entry=false)
@static if VERSION >= v"1.14.0-DEV.0"
d = InteractiveUtils._dump_function(
arginfo, false, false, true, false, :att, true, :none, false, "", params,
)
else
d = InteractiveUtils._dump_function(
arginfo, false, false, true, false, :att, true, :none, false, params,
)
end
return sprint(print, d)
end

_test_inlined_llvm(tt::Type{<:Tuple}) = _test_inlined_llvm(InteractiveUtils.ArgInfo(tt))
_test_inlined_llvm(f, t) = _test_inlined_llvm(InteractiveUtils.ArgInfo(f, t))
end

"""
@test_inlined f(x,y, ...)

Expand All @@ -52,16 +71,29 @@ make it into the native code, so this can be overly eager in declaring a
a lack of complete inlining.
"""
macro test_inlined(ex, should_inline=true)
ex_orig = ex
ex = macroexpand(@__MODULE__, :(@code_llvm $ex))
expr = quote
@static if hasfield(Base.CodegenParams, :safepoint_on_entry)
code_str = let params = Base.CodegenParams(safepoint_on_entry=false),
@static if VERSION >= v"1.13"
code_str = InteractiveUtils.gen_call_with_extracted_types(
__module__,
GlobalRef(@__MODULE__, :_test_inlined_llvm),
ex,
Expr[];
is_source_reflection=false,
use_signature_tuple=true,
)
else
ex = macroexpand(@__MODULE__, :(@code_llvm $ex))
code_str = quote
let params = Base.CodegenParams(safepoint_on_entry=false),
f = $(esc(ex.args[2])),
t = $(esc(ex.args[3]))
d = InteractiveUtils._dump_function(f, t, false, false, true, false, :att, true, :none, false, params)
sprint(print, d)
end
end
end
expr = quote
@static if hasfield(Base.CodegenParams, :safepoint_on_entry)
code_str = $code_str
else
code_str = sprint() do io
code_llvm(io, $(map(esc, ex.args[2:end])...))
Expand Down
Loading