Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect dispatch on Base.Callable #50

Open
MasonProtter opened this issue Jun 1, 2024 · 0 comments
Open

Incorrect dispatch on Base.Callable #50

MasonProtter opened this issue Jun 1, 2024 · 0 comments

Comments

@MasonProtter
Copy link

MasonProtter commented Jun 1, 2024

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)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant