Skip to content

map should work on dimension mismatch cases #1140

Open
@putianyi889

Description

@putianyi889
julia> map(+,[1,2,3],1:4)
3-element Vector{Int64}:
 2
 4
 6

julia> map(+,SVector(1,2,3),1:4)
ERROR: DimensionMismatch: Sizes (Size(3,), (4,)) of input arrays do not match
Stacktrace:
 [1] _throw_size_mismatch(::SVector{3, Int64}, ::Vararg{Any})
   @ StaticArrays C:\Users\pty\.julia\packages\StaticArrays\4WE4t\src\traits.jl:116
 [2] same_size
   @ C:\Users\pty\.julia\packages\StaticArrays\4WE4t\src\traits.jl:110 [inlined]
 [3] macro expansion
   @ C:\Users\pty\.julia\packages\StaticArrays\4WE4t\src\mapreduce.jl:74 [inlined]
 [4] _map(::typeof(+), ::SVector{3, Int64}, ::UnitRange{Int64})
   @ StaticArrays C:\Users\pty\.julia\packages\StaticArrays\4WE4t\src\mapreduce.jl:40
 [5] map(f::Function, a1::SVector{3, Int64}, as::UnitRange{Int64})
   @ StaticArrays C:\Users\pty\.julia\packages\StaticArrays\4WE4t\src\mapreduce.jl:31
 [6] top-level scope
   @ REPL[14]:1

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