From eaf9e53488e43b87327a949a7a51a2fd734582cc Mon Sep 17 00:00:00 2001 From: Bart Janssens Date: Sun, 13 Sep 2026 16:48:57 +0200 Subject: [PATCH 1/3] Extend to_indices to accept any integer in StaticArray index --- src/indexing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indexing.jl b/src/indexing.jl index a42fedf4..a573e561 100644 --- a/src/indexing.jl +++ b/src/indexing.jl @@ -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 From 90766fb44af8bba62e656db80236bee566e0c0b7 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Wed, 16 Sep 2026 11:18:32 +0200 Subject: [PATCH 2/3] some fixes for Julia 1.13, bump version --- Project.toml | 2 +- src/abstractarray.jl | 3 ++- test/testutil.jl | 36 +++++++++++++++++++++++++++++++----- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index b92145a0..cd364853 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/abstractarray.jl b/src/abstractarray.jl index b7806fd6..48e3fbf3 100644 --- a/src/abstractarray.jl +++ b/src/abstractarray.jl @@ -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 diff --git a/test/testutil.jl b/test/testutil.jl index f3faad7c..1937c07e 100644 --- a/test/testutil.jl +++ b/test/testutil.jl @@ -41,6 +41,19 @@ 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) + d = InteractiveUtils._dump_function( + arginfo, false, false, true, false, :att, true, :none, false, params, + ) + 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, ...) @@ -52,16 +65,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])...)) From 43d0fc41a35ef1281d27feb377912e6fc2491da1 Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Wed, 16 Sep 2026 11:42:39 +0200 Subject: [PATCH 3/3] also fix inlining test on Julia nightly --- test/testutil.jl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/testutil.jl b/test/testutil.jl index 1937c07e..f75d668e 100644 --- a/test/testutil.jl +++ b/test/testutil.jl @@ -44,9 +44,15 @@ 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) - d = InteractiveUtils._dump_function( - arginfo, false, false, true, false, :att, true, :none, false, params, - ) + @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