From fc807f2a054136610e2c9b7752906eed4ed3ad2e Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Thu, 8 Oct 2026 12:12:35 -0400 Subject: [PATCH 1/3] Fix method ambiguity in similar(::AbstractVectorOfArray, ::Type, dims) on Julia 1.10 Making AbstractVectorOfArray <: AbstractArray (#547) made RAT's similar(VA::AbstractVectorOfArray, ::Type{T}, dims::Tuple{Union{Integer,Base.OneTo}, Vararg{...}}) ambiguous with Base.similar(a::AbstractArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}}), a Base fallback method that exists on Julia 1.10/1.11 but was removed in 1.12. This was masked by the Aqua ambiguities exemption until #648 removed it, so GROUP=QA on Julia 1.10 (the "lts" CI matrix entry) started failing on master. Adds the more specific Integer-only method Aqua's own diagnostic suggested, mirroring the analogous pair of methods Base itself defines, resolving the ambiguity without an Aqua exclusion. Co-Authored-By: Chris Rackauckas Co-Authored-By: Claude Agent-Harness: Claude Code Agent-Model: claude-sonnet-5 Agent-Session: https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv --- src/vector_of_array.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vector_of_array.jl b/src/vector_of_array.jl index af4da6e9..0ca19a09 100644 --- a/src/vector_of_array.jl +++ b/src/vector_of_array.jl @@ -1162,6 +1162,16 @@ end ) where {T} return similar(Array{T}, dims) end +# On Julia versions where Base.similar(::AbstractArray, ::Type, ::Tuple{Integer, +# Vararg{Integer}}) still exists (removed upstream in 1.12), that method and the +# one above are each more specific than the other in one argument position, +# which Aqua reports as an ambiguity. Pin down the Integer-only intersection +# explicitly, mirroring the equivalent pair of methods Base itself defines. +@inline function Base.similar( + VA::AbstractVectorOfArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}} + ) where {T} + return similar(Array{T}, dims) +end # fill! From 1936cc26066359bfe5378b538e1c14e837240f72 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 17 Oct 2026 14:26:30 -0400 Subject: [PATCH 2/3] Add Core regression coverage for explicit similar dimensions Cover non-Int integer tuples and existing Int, empty and OneTo paths for VectorOfArray and DiffEqArray. The new test reports eight ambiguity errors without the dispatch fix on Julia 1.10 and passes 48 assertions with it; Julia 1.12 passes the same assertions before and after. Co-Authored-By: Chris Rackauckas Co-Authored-By: Codex Agent-Harness: Codex CLI 0.163.0 Agent-Model: gpt-6.1-sol Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/rat/qa-master/log-codex.txt on amdci2 --- test/Core/similar_tests.jl | 22 ++++++++++++++++++++++ test/runtests.jl | 1 + 2 files changed, 23 insertions(+) create mode 100644 test/Core/similar_tests.jl diff --git a/test/Core/similar_tests.jl b/test/Core/similar_tests.jl new file mode 100644 index 00000000..2c01dd07 --- /dev/null +++ b/test/Core/similar_tests.jl @@ -0,0 +1,22 @@ +using RecursiveArrayTools, Test + +@testset "similar with explicit dimensions" begin + data = [[1, 2], [3, 4]] + for A in (VectorOfArray(data), DiffEqArray(data, [0, 1])) + @testset "$(nameof(typeof(A))) $dims" for (dims, expected_size) in ( + ((Int32(2), Int32(3)), (2, 3)), + ((UInt8(2), UInt8(3)), (2, 3)), + ((big(2), big(3)), (2, 3)), + ((true, false), (1, 0)), + ((2, 3), (2, 3)), + ((), ()), + ((Base.OneTo(2), Base.OneTo(3)), (2, 3)), + ((2, Base.OneTo(3)), (2, 3)), + ) + result = similar(A, Float64, dims) + @test result isa Array + @test size(result) == expected_size + @test eltype(result) === Float64 + end + end +end diff --git a/test/runtests.jl b/test/runtests.jl index b50e7b45..d9b8c39a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -19,6 +19,7 @@ run_tests(; @time @safetestset "Partitions and StaticArrays Tests" include("Core/partitions_and_static_arrays.jl") @time @safetestset "VecOfArr Indexing Tests" include("Core/basic_indexing.jl") @time @safetestset "VecOfArr Interface Tests" include("Core/interface_tests.jl") + @time @safetestset "VecOfArr Similar Tests" include("Core/similar_tests.jl") @time @safetestset "Public API Tests" include("Core/public_api_test.jl") @time @safetestset "Table traits" include("Core/tabletraits.jl") @time @safetestset "StaticArrays Tests" include("Core/copy_static_array_test.jl") From a781d44e25c93d2be2b7b9c93b8fd6c5e1679925 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 17 Oct 2026 23:50:51 -0400 Subject: [PATCH 3/3] Clarify the similar dispatch intersection comment Co-Authored-By: Chris Rackauckas Co-Authored-By: Codex Agent-Harness: Codex CLI 0.163.0 Agent-Model: gpt-6.1-sol Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/rat/qa-master/log-codex.txt on amdci2 --- src/vector_of_array.jl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/vector_of_array.jl b/src/vector_of_array.jl index 022ea997..092215e4 100644 --- a/src/vector_of_array.jl +++ b/src/vector_of_array.jl @@ -1162,11 +1162,7 @@ end ) where {T} return similar(Array{T}, dims) end -# On Julia versions where Base.similar(::AbstractArray, ::Type, ::Tuple{Integer, -# Vararg{Integer}}) still exists (removed upstream in 1.12), that method and the -# one above are each more specific than the other in one argument position, -# which Aqua reports as an ambiguity. Pin down the Integer-only intersection -# explicitly, mirroring the equivalent pair of methods Base itself defines. +# Disambiguates against Base's integer-dimension similar fallback on Julia ≤ 1.11. @inline function Base.similar( VA::AbstractVectorOfArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}} ) where {T}