Skip to content

possible dispatch bug: method static parameter matching fails #55172

@nsajko

Description

@nsajko
struct W{P}
    p::P   
end

struct U{T, N, NTuple{N, T}<:V<:Union{NTuple{2, T}, NTuple{3, T}}}
    a::W{V}
end

w = W((1,2))
U(w)  # UndefVarError: `V` not defined in static parameter matching

The fact that T and N match successfully suggests that V, too, should be uniquely defined, given that the lower bound is then NTuple{2,Int}.

Not a recent regression, v1.6 behaves the same.

Origin at Discourse for context: https://discourse.julialang.org/t/adding-both-upper-bounds-and-lower-bounds-to-type-parameters/117212/4?u=nsajko

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