Skip to content

Commit 295d275

Browse files
committed
Fix IEX's s helper to correctly handle MF and MFA requests
1 parent 4c1f445 commit 295d275

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/iex/lib/iex/helpers.ex

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ defmodule IEx.Helpers do
344344

345345
@doc false
346346
def s(module, function) when is_atom(function) do
347-
specs = lc {{f, _arity}, _spec} = spec inlist beam_specs(module),
347+
specs = lc {_kind, {{f, _arity}, _spec}} = spec inlist beam_specs(module),
348348
f == function do
349349
print_spec(spec)
350350
spec
@@ -369,7 +369,13 @@ defmodule IEx.Helpers do
369369

370370
@doc false
371371
def s(module, function, arity) do
372-
spec = List.keyfind(beam_specs(module), { function, arity }, 0)
372+
case Enum.filter(beam_specs(module),
373+
fn({_type, {{f,a}, _value}}) ->
374+
f == function and a == arity
375+
end) do
376+
[spec] -> :ok
377+
_ -> spec = nil
378+
end
373379

374380
if spec do
375381
print_spec(spec)

0 commit comments

Comments
 (0)