Skip to content

Handling of <:Union{} #37255

Closed
Closed

Description

I think this should not be allowed:

julia> f(::Type{Union{}}) = "a"
f (generic function with 1 method)

julia> f(::Type{<:Union{}}) = "b"
f (generic function with 2 methods)

julia> methods(f)
# 2 methods for generic function "f":
[1] f(::Type{var"#s1"} where var"#s1"<:Union{}) in Main at REPL[2]:1
[2] f(::Type{Union{}}) in Main at REPL[1]:1

julia> f(Union{})
"b"

and the compiler should identify that these two signatures are identical as Union{} is bottom type.

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

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