JuliaArrays / OffsetArrays.jl

Fortran-like arrays with arbitrary, zero or negative starting indices.
Other
197 stars 40 forks source link

test broken with Julia master #353

Open matthias314 opened 3 months ago

matthias314 commented 3 months ago

The test https://github.com/JuliaArrays/OffsetArrays.jl/blob/3b94d643b877732562e8fa18829892af73e790c0/test/runtests.jl#L1898 fails on Julia master because the left-hand side errors (with FillArrays 1.11.0):

julia> using FillArrays

julia> reshape(Fill(2,6), big(2), :)
ERROR: TypeError: in typeassert, expected Tuple{Vararg{Int64}}, got a value of type Tuple{BigInt}
Stacktrace:
 [1] _reshape_uncolon
   @ ./reshapedarray.jl:135 [inlined]
 [2] reshape(parent::Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, dims::Tuple{BigInt, Colon})
   @ FillArrays ~/.julia/packages/FillArrays/eOEVm/src/FillArrays.jl:269
 [3] reshape(::Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}, ::BigInt, ::Colon)
   @ FillArrays ~/.julia/packages/FillArrays/eOEVm/src/FillArrays.jl:265
 [4] top-level scope
   @ REPL[4]:1

It works, however, with Julia 1.10.4 and 1.11.0-beta1. I don't know if this is an issue for OffsetArrays, for FillArrays or for Julia itself. I simply note that Julia itself doesn't support BigInt arguments for reshape:

julia> reshape(1:2, big(2))
ERROR: MethodError: no method matching reshape(::UnitRange{Int64}, ::BigInt)
The function `reshape` exists, but no method is defined for this combination of argument types.

(tested with Julia 1.10.4, 1.11.0-beta1 and master).

nsajko commented 1 month ago

This is a FillArrays bug, can someone move the issue to the FillArrays repo? Xref JuliaLang/julia#54261

matthias314 commented 1 month ago

I can do that. In the meantime, here is another test of the master version that fails on Julia nightly:

mapreduce for OffsetRange: Error During Test at ~/.julia/packages/OffsetArrays/hwmnB/test/runtests.jl:2096
  Got exception outside of a @test
  BoundsError: attempt to access 1-element OffsetArray(::Vector{Int64}, 3:3) with eltype Int64 with indices 3:3 at index [1]
  Stacktrace:
    [1] throw_boundserror(A::OffsetVector{Int64, Vector{Int64}}, I::Tuple{Int64})
      @ Base ./essentials.jl:14
    [2] checkbounds
      @ ./abstractarray.jl:699 [inlined]
    [3] getindex
      @ ~/.julia/packages/OffsetArrays/hwmnB/src/OffsetArrays.jl:437 [inlined]
    [4] _mapreducedim!(f::typeof(identity), op::typeof(+), R::OffsetVector{Int64, Vector{Int64}}, A::OffsetVector{Int64, UnitRange{Int64}})
      @ Base ./reducedim.jl:262
    [5] mapreducedim!(f::Function, op::Function, R::OffsetVector{Int64, Vector{Int64}}, A::OffsetVector{Int64, UnitRange{Int64}})
      @ Base ./reducedim.jl:292
    [6] _mapreduce_dim(f::Function, op::Function, ::Base._InitialValue, A::OffsetVector{Int64, UnitRange{Int64}}, dims::Int64)
      @ Base ./reducedim.jl:339
    [7] #mapreduce#950
      @ ./reducedim.jl:325 [inlined]
    [8] top-level scope
      @ ~/.julia/packages/OffsetArrays/hwmnB/test/runtests.jl:2061
    [9] macro expansion
      @ /tmp/julia-6916eb7420/share/julia/stdlib/v1.12/Test/src/Test.jl:1703 [inlined]
   [10] macro expansion
      @ ~/.julia/packages/OffsetArrays/hwmnB/test/runtests.jl:2097 [inlined]
   [11] macro expansion
      @ /tmp/julia-6916eb7420/share/julia/stdlib/v1.12/Test/src/Test.jl:1703 [inlined]
   [12] macro expansion
      @ ~/.julia/packages/OffsetArrays/hwmnB/test/runtests.jl:2113 [inlined]
   [13] include(fname::String)
      @ Main ./sysimg.jl:38
   [14] top-level scope
      @ none:6
   [15] eval
      @ ./boot.jl:439 [inlined]
   [16] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:290
   [17] _start()
      @ Base ./client.jl:553
Test Summary:               | Pass  Error  Total  Time
reductions                  |   22      1     23  8.1s
  mapreduce for OffsetRange |    2      1      3  2.4s
ERROR: LoadError: Some tests did not pass: 22 passed, 0 failed, 1 errored, 0 broken.
in expression starting at ~/.julia/packages/OffsetArrays/hwmnB/test/runtests.jl:2060
ERROR: Package OffsetArrays errored during testing
nsajko commented 1 month ago

Probably you want to open a new issue for that bug.

jishnub commented 1 month ago

The mapreduce issue a bug in Base, and should be resolved by https://github.com/JuliaLang/julia/pull/55506