Skip to content

Incorrect dispatch on Base.Callable #50

Open
@MasonProtter

Description

@MasonProtter

This was surfaced in https://discourse.julialang.org/t/how-do-i-precompile-a-callable-struct/115037/5, this package is assuming that only subtypes of Base.Callable have methods, but that's not true.

julia> struct Foo end

julia> (::Foo)() = 1

julia> Foo()()
1

julia> Foo() isa Base.Callable
false

julia> methodinstances((Foo(),))
Core.MethodInstance[]

versus

julia> struct Bar <: Function end

julia> (::Bar)() = 1

julia> Bar()()
1

julia> methodinstances((Bar(),))
1-element Vector{Core.MethodInstance}:
 MethodInstance for (::Bar)()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions