Skip to content

Unnecessarily wide types with setindex!! #39

@mhauru

Description

@mhauru
julia> setindex!!([1.0], Real[1.0], :)
1-element Vector{Any}:
 1.0

The element type here should be Real, but is Any. I think the culprit may be this line:

T = promote_type(eltype(xs), typeof(v))
in

function _setindex(xs::AbstractArray, v, I...)
    T = promote_type(eltype(xs), typeof(v))
    blahblah

That's fine as long as the I is a single index, but if I is some sort of range-like thing, such as a Colon in my MWE, we should use eltype(v) instead of typeof(v).

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