Skip to content

UndefRefError for keyword methods with anonymous type variable in where bound #173

Open

Description

@borisdevos

Hi, apologies if this issue should be in Revise.jl instead of here. I encountered this issue and worked around it in QuantumKitHub/MPSKit.jl#540.

Somehow, when a keyword argument method has an anonymous type variable inside the bound of a static parameter (in my specific case a where bound), the keyword-body function can't be resolved and raises a warning of the form

┌ Warning: skipping callee Main.:(var"#f#2") (called by Main.f) due to UndefRefError()
└ @ LoweredCodeUtils ~/.julia/packages/LoweredCodeUtils/WbxFQ/src/signatures.jl:344

When Revise attempts to rerun this signature, it freezes my REPL. I'm on Julia v1.12.6, Windows 11 if that matters.

Edit: I found a second trigger, namely anonymous type variables in the type of callable objects. MWE for the 2nd case:

struct Foo{T} end
(h::Foo{<:Integer})(x; kw...) = 1 # warns
(::Type{<:Foo})(x; kw...) = 1  # warns
(h::Foo{T})(x; kw...) where {T <: Integer} = 1 # fine
(h::Foo{<:Integer})(x) = 1 # fine (no keyword arguments)
(h::Foo)(x::Vector{<:Integer}; kw...) = 1 # fine (<: only in an argument type)

Activity

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

Metadata

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