Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
As often happens, this discovered a bug on some Julia versions.
  • Loading branch information
timholy committed Feb 2, 2022
1 parent 3cd646e commit 4839d35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/MethodAnalysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Split a signature type like `Tuple{typeof(f),ArgTypes...}` back out to `(f, Tupl
function call_type(tt)
ft = tt.parameters[1]
argt = Tuple{tt.parameters[2:end]...}
name = Symbol(String(ft.name.name)[2:end]) # strip off leading '#'
return (getfield(ft.name.module, name), argt)
name = Symbol(String(ft.name.name))
return (getfield(ft.name.module, name).instance, argt)
end

"""
Expand Down
9 changes: 5 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ end
@test methodinstance(f, (Real,)) === nothing
mi = methodinstance(f, (Float64,))
@test mi.specTypes == Tuple{typeof(f),Float64}
mis = methodinstances(f, (Real,))
@test length(mis) == 2
@test all(mis) do mi
mi.specTypes (Tuple{typeof(f),Float64}, Tuple{typeof(f),Int})
for mis in (methodinstances(f, (Real,)), methodinstances(Tuple{typeof(f),Real}))
@test length(mis) == 2
@test all(mis) do mi
mi.specTypes (Tuple{typeof(f),Float64}, Tuple{typeof(f),Int})
end
end
end

Expand Down

0 comments on commit 4839d35

Please sign in to comment.