timholy / timholy/MethodAnalysis.jl

Incorrect dispatch on `Base.Callable`

Open
#50 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
97
Forks
5
PR merge metrics
No merged PRs in 30d

Description

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)()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Julia reproducer in the issue and trace the package's handling of methodinstances and Base.Callable. Verify the behavior for callable structs that do and do not subtype Function, then confirm that both cases are dispatched and analyzed correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.