Skip to content

definition throws error on (Pair{A, B})(a, b) #119

@Zentrik

Description

@Zentrik

The method is defined as

@eval function (P::Type{Pair{A, B}})(@nospecialize(a), @nospecialize(b)) where {A, B}
    @inline
    return $(Expr(:new, :P, :(convert(A, a)), :(convert(B, b))))
end
(CodeTracking) julia> method = @which Pair{Int, Int}(1, 1)
Pair{A, B}(a, b) where {A, B}
     @ Base ~/.julia/juliaup/julia-1.9.2+0.x64.linux.gnu/share/julia/base/Base.jl:138

(CodeTracking) julia> definition(String, method)
ERROR: AssertionError: isexpr(wheretyp, :<:)
Stacktrace:
 [1] is_func_expr(ex::Any, meth::Method)
   @ CodeTracking /media/rag/NVME/Code/CodeTracking.jl/src/utils.jl:103
 [2] definition(#unused#::Type{String}, method::Method)
   @ CodeTracking /media/rag/NVME/Code/CodeTracking.jl/src/CodeTracking.jl:261
 [3] top-level scope
   @ REPL[208]:1

It seems like the problem is the fname is :(P::Type{Pair{A, B}}) at https://github.com/timholy/CodeTracking.jl/blob/9db8d0ea32d526cbbd5c09e6246db7c60f77774d/src/utils.jl#L76 but is :Type at https://github.com/timholy/CodeTracking.jl/blob/9db8d0ea32d526cbbd5c09e6246db7c60f77774d/src/utils.jl#L99
strip_gensym(meth.name) is :Pair.

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