Skip to content

Int[].=missing vs Int[].+=missing #34002

Open
@rapus95

Description

Related to #33645
Back in the fill! case it was clear to me that we wanted to prefer type stability over special casing.
But here, it feels plainly inconsistent:

julia> Int[].+=missing
0-element Array{Int64,1}

julia> Int[].=missing
ERROR: MethodError: Cannot `convert` an object of type Missing to an object of type Int64
Closest candidates are:
  convert(::Type{Int64}, ::Type{CUDAnative.AS.Generic}) at C:\Users\Matthis\.julia\packages\CUDAnative\Lr0yj\src\device\pointer.jl:107
  convert(::Type{Int64}, ::Type{CUDAnative.AS.Global}) at C:\Users\Matthis\.julia\packages\CUDAnative\Lr0yj\src\device\pointer.jl:108
  convert(::Type{Int64}, ::Type{CUDAnative.AS.Shared}) at C:\Users\Matthis\.julia\packages\CUDAnative\Lr0yj\src\device\pointer.jl:109
  ...
Stacktrace:
 [1] fill!(::Array{Int64,1}, ::Missing) at .\array.jl:309
 [2] copyto! at .\broadcast.jl:871 [inlined]
 [3] materialize!(::Array{Int64,1}, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(identity),Tuple{Base.RefValue{Missing}}}) at .\broadcast.jl:822
 [4] top-level scope at REPL[13]:1

I see that this is the case because of the referenced fill! case, but nevertheless, it irritates me. Is there any way to look onto this difference which is consistent?

Metadata

Assignees

No one assigned

    Labels

    broadcastApplying a function over a collectionmissing dataBase.missing and related functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions