Skip to content

Commit 39d640e

Browse files
committed
Merge pull request #11055 from JuliaLang/jcb/fixmethodswith
adapt `methodswith` to new Tuple types, fixes #11052
2 parents 5f3bd18 + 847152d commit 39d640e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

base/interactiveutil.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ function methodswith(t::Type, f::Function, showparents::Bool=false, meths = Meth
287287
return meths
288288
end
289289
d = f.env.defs
290-
while !is(d,())
290+
while d != nothing
291291
if any(x -> (type_close_enough(x, t) ||
292292
(showparents ? (t <: x && (!isa(x,TypeVar) || x.ub != Any)) :
293293
(isa(x,TypeVar) && x.ub != Any && t == x.ub)) &&
294294
x != Any && x != ANY),
295-
d.sig)
295+
d.sig.parameters)
296296
push!(meths, d)
297297
end
298298
d = d.next

test/misc.jl

+5
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,8 @@ end
112112
@test gc_disable() == false
113113
@test gc_enable() == false
114114
@test gc_enable()
115+
116+
# test methodswith
117+
immutable NoMethodHasThisType end
118+
@test isempty(methodswith(NoMethodHasThisType))
119+
@test !isempty(methodswith(Int))

0 commit comments

Comments
 (0)