MethodAnalysis.jl
MethodAnalysis.jl copied to clipboard
Incorrect dispatch on `Base.Callable`
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)()