-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update the OffsetArray test helper #45387
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring and compat patch are not needed for test helper, but it doesn't matter much to include them.
This PR is required for #45371. As long as the CI is green, I believe it's okay to merge and update the test-only dependency.
@@ -671,7 +671,7 @@ end | |||
# issue #38627 | |||
@testset "overflow in mapreduce" begin | |||
# at len = 16 and len = 1025 there is a change in codepath | |||
for len in [0, 1, 15, 16, 1024, 1025, 2048, 2049] | |||
for len in [1, 15, 16, 1024, 1025, 2048, 2049] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since OffsetArrays more eagerly checks the overflow behavior, len=0
is indeed an undefined behavior so I agree to remove it. -- Specially handling length 0 array could also be problematic because user codes might do push!(parent(offset_vector), x)
.
This OffsetArray(Int[], typemax(Int))
issue is already caught in OffsetArrays codebase https://github.com/JuliaArrays/OffsetArrays.jl/blob/44f9b50c5428416c8baa76af882c820605c17082/test/runtests.jl#L518
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The length-0 case is also related to #45389
I don't really understand the reported ambiguities. Eg: (reshape(A::Main.OffsetArrays.OffsetArray, inds::Tuple{Vararg{Union{Colon, Int64}}}) in Main.OffsetArrays at /home/jishnu/julia/test/testhelpers/OffsetArrays.jl:564,
reshape(parent::AbstractVector, ::Tuple{Colon}) in Base at reshapedarray.jl:116) but there's reshape(A::OffsetVector{T} where T, ::Tuple{Colon}) in Main.OffsetArrays at /home/jishnu/julia/test/testhelpers/OffsetArrays.jl:561 which should remove this ambiguity? Also, the methods are an exact copy from |
Test failures seem unrelated at this point |
Sync the
OffsetArray
test helper with the repo.