@@ -21,7 +21,7 @@ groups = methodgroups(f, Union{Tuple{Any}, Tuple{Any, Integer}}, Main; exact = f
2121"""
2222function methodgroups (func, typesig, modname; exact = true )
2323 # Group methods by file and line number.
24- local methods = Set {Method} ( getmethods (func, typesig) )
24+ local methods = getmethods (func, typesig)
2525 local groups = groupby (Tuple{Symbol, Int}, Vector{Method}, methods) do m
2626 (m. file, m. line), m
2727 end
@@ -32,7 +32,7 @@ function methodgroups(func, typesig, modname; exact = true)
3232 for (key, group) in groups
3333 filter! (group) do m
3434 local ismod = m. module == modname
35- exact ? (ismod && Base. tuple_type_tail (m. sig) in typesigs) : ismod
35+ exact ? (ismod && Base. rewrap_unionall (Base . tuple_type_tail (m . sig), m. sig) in typesigs) : ismod
3636 end
3737 isempty (group) || push! (results, group)
3838 end
@@ -80,8 +80,10 @@ function getmethods!(results, f, sig)
8080 append! (results, methods (f))
8181 elseif isa (sig, Union)
8282 for each in uniontypes (sig)
83- append ! (results, getmethods ( f, each) )
83+ getmethods ! (results, f, each)
8484 end
85+ elseif isa (sig, UnionAll)
86+ getmethods! (results, f, Base. unwrap_unionall (sig))
8587 else
8688 append! (results, methods (f, sig))
8789 end
@@ -95,7 +97,7 @@ Collect and return all methods of function `f` matching signature `sig`.
9597This is similar to `methods(f, sig)`, but handles type signatures found in `DocStr` objects
9698more consistently that `methods`.
9799"""
98- getmethods (f, sig) = getmethods! (Method[], f, sig)
100+ getmethods (f, sig) = unique ( getmethods! (Method[], f, sig) )
99101
100102
101103"""
@@ -118,7 +120,17 @@ $(:SIGNATURES)
118120
119121Returns a `Vector` of the `Tuple` types contained in `sig`.
120122"""
121- alltypesigs (sig) = sig == Union{} ? Any[] : isa (sig, Union) ? uniontypes (sig) : Any[sig]
123+ function alltypesigs (sig):: Vector{Any}
124+ if sig == Union{}
125+ Any[]
126+ elseif isa (sig, Union)
127+ uniontypes (sig)
128+ elseif isa (sig, UnionAll)
129+ Base. rewrap_unionall .(uniontypes (Base. unwrap_unionall (sig)), sig)
130+ else
131+ Any[sig]
132+ end
133+ end
122134
123135"""
124136$(:SIGNATURES )
0 commit comments