Skip to content

Commit f91d1cc

Browse files
Mark any/all optimized dispatch as @test_broken without extension
Add @test_broken checks verifying that the optimized partition-level any/all methods (from RecursiveArrayToolsArrayPartitionAnyAll) are NOT active in the base package. Without the extension, any/all use the AbstractArray element-by-element fallback which is correct but slower. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6622e19 commit f91d1cc

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

test/partitions_test.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,14 @@ recursivecopy!(dest_ap, src_ap)
178178
@inferred mapreduce(string, *, x)
179179
@test mapreduce(i -> string(i) * "q", *, x) == "1q2q3.0q4.0q"
180180

181-
# any
181+
# any/all — optimized partition-level iteration requires RecursiveArrayToolsArrayPartitionAnyAll.
182+
# Without the extension, these use the AbstractArray element-by-element fallback.
183+
# `using RecursiveArrayToolsArrayPartitionAnyAll` enables ~1.5-1.8x faster partition-level
184+
# short-circuiting. These @test_broken verify the optimized methods are NOT active.
185+
@test_broken which(any, Tuple{Function, ArrayPartition}).module !== Base
186+
@test_broken which(all, Tuple{Function, ArrayPartition}).module !== Base
187+
188+
# Correctness tests still pass via AbstractArray fallback
182189
@test !any(isnan, AP[[1, 2], [3.0, 4.0]])
183190
@test !any(isnan, AP[[3.0, 4.0]])
184191
@test any(isnan, AP[[NaN], [3.0, 4.0]])
@@ -187,7 +194,6 @@ recursivecopy!(dest_ap, src_ap)
187194
@test any(isnan, AP[[2], [NaN]])
188195
@test any(isnan, AP[[2], AP[[NaN]]])
189196

190-
# all
191197
@test !all(isnan, AP[[1, 2], [3.0, 4.0]])
192198
@test !all(isnan, AP[[3.0, 4.0]])
193199
@test !all(isnan, AP[[NaN], [3.0, 4.0]])
@@ -382,7 +388,8 @@ for i in 1:length(part_a.x)
382388
@test typeof(sub_a) === typeof(sub_b) # Test type equality
383389
end
384390

385-
# ArrayPartition `all` with a functor
391+
# ArrayPartition `all` with a functor (works via AbstractArray fallback,
392+
# optimized partition-level iteration requires RecursiveArrayToolsArrayPartitionAnyAll)
386393
struct TestIsnanFunctor end
387394
(::TestIsnanFunctor)(x) = isnan(x)
388395
@test all(TestIsnanFunctor(), AP[[NaN], [NaN]])

0 commit comments

Comments
 (0)