Skip to content

Base._return_type usages wrong for Type return #25499

Open

Description

Our functions that call Core.Inference._return_type are failing to account for the possibility that functions can return a Type and that inference is capable of determining that. Simple repro can be seen by testing broadcast (result should be either Array{DataType, 1} or Array{Union{}, 1}):

julia> typeof(broadcast(typeof, Float32[]))
Array{Type{Float32}, 1}

note: map gets the "right" answer, but this is more due to inference failing on @code_typed first(Base.Generator(typeof, Float32[])) rather than it actually handling this case correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions