Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decorate_arg errors out if arg_ast is not a tuple #36

Open
imeraj opened this issue Feb 1, 2025 · 0 comments
Open

decorate_arg errors out if arg_ast is not a tuple #36

imeraj opened this issue Feb 1, 2025 · 0 comments

Comments

@imeraj
Copy link

imeraj commented Feb 1, 2025

While playing with the code here, I encountered an issue in decorate_arg function -

if elem(arg_ast, 0) == :\\ do

Looks like if there is pattern matching like

  deftraceable foo(_, 0) do
    :error
  end

This line throws an error -

== Compilation error in file tracer_test.exs ==
** (ArgumentError) errors were found at the given arguments:

  * 2nd argument: not a tuple

    :erlang.element(1, 0)
    tracer.exs:55: Tracer.decorate_args/1
    (elixir 1.14.4) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.14.4) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
    tracer.exs:50: Tracer.decorate_args/1
    tracer_test.exs:6: (module)

I had to make below change to make the code work -

if is_tuple(arg_ast) and elem(arg_ast, 0) == :\\ do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant