Skip to content

subtype error with KV<:Union{K,Ref{K}} alternate constraint #40865

@AzamatB

Description

@AzamatB

The following works as expected:

function f(
    x::AbstractDict{KV,Tuple{Int}},
    y::Union{Set{K},Dict{K,V}},
) where {K,V, KV <: Union{K,Tuple{K,V}}}
    return "done"
end

K = Int
x = Dict{K,Tuple{Int}}()
y = Set{K}()

julia> f(x, y)
"done"

Now replace K = Int with K = Tuple{Int,Int} and now it throws MethodError: no method matching

Metadata

Metadata

Assignees

No one assigned

    Labels

    types and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions