Skip to content

Commit ba33acb

Browse files
committed
Make the key type of method_info concrete
1 parent ba1b0ee commit ba33acb

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/CodeTracking.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ include("utils.jl")
3333
# - `missing`, to indicate that the method cannot be located
3434
# - a list of `(lnn,ex)` pairs. In almost all cases there will be just one of these,
3535
# but "mistakes" in moving methods from one file to another can result in more than
36-
# definition. The last pair in the list is the currently-active definition.
37-
const method_info = IdDict{Pair{<:Union{Nothing, MethodTable}, <:Type},Union{Missing,Vector{Tuple{LineNumberNode,Expr}}}}()
36+
# one definition. The last pair in the list is the currently-active definition.
37+
const method_info = IdDict{Pair{Union{Nothing, MethodTable}, Type},Union{Missing,Vector{Tuple{LineNumberNode,Expr}}}}()
3838

3939
const _pkgfiles = Dict{PkgId,PkgFiles}()
4040

@@ -59,7 +59,7 @@ const juliabase = joinpath("julia", "base")
5959
const juliastdlib = joinpath("julia", "stdlib", "v$(VERSION.major).$(VERSION.minor)")
6060

6161
method_table(method::Method) = isdefined(method, :external_mt) ? method.external_mt::MethodTable : nothing
62-
method_info_key(method::Method) = method_table(method) => method.sig
62+
method_info_key(method::Method) = Pair{Union{Nothing, MethodTable}, Type}(method_table(method), method.sig)
6363

6464
### Public API
6565

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
101101

102102
# Test a method marked as missing
103103
m = @which sum(1:5)
104-
CodeTracking.method_info[nothing => m.sig] = missing
104+
CodeTracking.invoked_setindex!(CodeTracking.method_info, missing, nothing => m.sig)
105105
@test whereis(m) == (CodeTracking.maybe_fix_path(String(m.file)), m.line)
106106
@test definition(m) === nothing
107107

@@ -466,7 +466,7 @@ if isdefined(Base, :Experimental) && isdefined(Base.Experimental, :(var"@MethodT
466466
method = Core.eval(mod, ex)
467467
lnn = LineNumberNode(Int(method.line), method.file)
468468
@test CodeTracking.definition(Expr, method) === nothing
469-
CodeTracking.method_info[method.external_mt => method.sig] = [(lnn, ex)]
469+
CodeTracking.invoked_setindex!(CodeTracking.method_info, [(lnn, ex)], method.external_mt => method.sig)
470470
@test CodeTracking.definition(Expr, method) == ex
471471
end
472472

0 commit comments

Comments
 (0)