Skip to content

failures for non-Int64 ranges #454

@ogauthe

Description

@ogauthe

There has been significant work on generalizing BlockArrays to non-Int64 index type, including #405 . I still find some missing cases:

  • convert into an AbstractUnitRange fails
using BlockArrays: blockedrange, mortar
convert(AbstractUnitRange{Int64}, blockedrange([Int32(1)]))
ERROR: MethodError: no method matching AbstractUnitRange{Int64}(::BlockedOneTo{Int32, Vector{Int32}})
The type `AbstractUnitRange{Int64}` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  AbstractUnitRange{T}(::AbstractUnitRange{T}) where T
   @ Base range.jl:1295
  AbstractUnitRange{Int64}(::Static.OptionallyStaticUnitRange)
   @ Static ~/.julia/packages/Static/SeEGr/src/ranges.jl:258
  AbstractUnitRange{T}(::Static.OptionallyStaticUnitRange) where T
   @ Static ~/.julia/packages/Static/SeEGr/src/ranges.jl:259
  ...

Stacktrace:
 [1] convert(::Type{AbstractUnitRange{Int64}}, r::BlockedOneTo{Int32, Vector{Int32}})
   @ Base ./range.jl:269
 [2] top-level scope
   @ REPL[1]:1**
  • broadcasting fails for non-Int64 ranges
v = mortar([[1]], (blockedrange([Int32(1)]),))
Int.(v)
ERROR: MethodError: no method matching subblocks(::BlockVector{Int64, Vector{…}, Tuple{…}}, ::Tuple{BlockedOneTo{…}}, ::Int64)
The function `subblocks` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  subblocks(::AbstractArray, ::NTuple{N, AbstractUnitRange{Int64}}, ::Integer) where N
   @ BlockArrays ~/.julia/packages/BlockArrays/XczLX/src/blockbroadcast.jl:119
  subblocks(::Any, ::NTuple{N, AbstractUnitRange{Int64}}, ::Integer) where N
   @ BlockArrays ~/.julia/packages/BlockArrays/XczLX/src/blockbroadcast.jl:116

Stacktrace:
 [1] (::BlockArrays.var"#58#63"{BlockVector{}, Base.Broadcast.Broadcasted{}, Tuple{}})(dim::Int64)
   @ BlockArrays ~/.julia/packages/BlockArrays/XczLX/src/blockbroadcast.jl:147
 [2] ntuple
   @ ./ntuple.jl:19 [inlined]
 [3] _generic_blockbroadcast_copyto!
   @ ~/.julia/packages/BlockArrays/XczLX/src/blockbroadcast.jl:146 [inlined]
 [4] copyto!(dest::BlockVector{…}, bc::Base.Broadcast.Broadcasted{…})
   @ BlockArrays ~/.julia/packages/BlockArrays/XczLX/src/blockbroadcast.jl:187
 [5] copy
   @ ./broadcast.jl:897 [inlined]
 [6] materialize(bc::Base.Broadcast.Broadcasted{BlockArrays.BlockStyle{1}, Nothing, Type{Int64}, Tuple{BlockVector{…}}})
   @ Base.Broadcast ./broadcast.jl:872
 [7] top-level scope
   @ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions