Skip to content

promote_op doesn't play well with Union{Missing, T} #28370

@andyferris

Description

@andyferris

Sometimes I use promote_op to predict the element type of containers for non-trivial operations where the element type might change.

However, while working out how my packages might work with missing in v0.7 I came across this stumbling block:

julia> Base.promote_op(+, Int, Union{Float64, Missing})
Any

(I do realize there is a momentum to rely less on inference and more on "the type of actual elements at run-time" (at least in Base)... but sometimes the promote_op pattern is the quickest path to victory and I don't see why it shouldn't work as well as possible).

Metadata

Metadata

Assignees

No one assigned

    Labels

    won't changeIndicates that work won't continue on an issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions