Skip to content

Commit 40ee1d9

Browse files
committed
fix #9866, edit(func)
- error and ask for types if there is > 1 method - otherwise edit the only existing method
1 parent e243ed9 commit 40ee1d9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

base/reflection.jl

+10-2
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,17 @@ function functionloc(m::Method)
190190
(find_source_file(string(lsd.file)), ln)
191191
end
192192

193-
functionloc(f::ANY, types=(Any...)) = functionloc(which(f,types))
193+
functionloc(f::ANY, types) = functionloc(which(f,types))
194194

195-
function function_module(f, types=(Any...))
195+
function functionloc(f)
196+
m = methods(f)
197+
if length(m) > 1
198+
error("function has multiple methods; please specify a type signature")
199+
end
200+
functionloc(m.defs)
201+
end
202+
203+
function function_module(f, types)
196204
m = methods(f, types)
197205
if isempty(m)
198206
error("no matching methods")

0 commit comments

Comments
 (0)