You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It gets called from a run_changeset pipeline → maybe_mark_for_deletion(changeset, module)
My code is in a library and run_changeset gets called with user code, so how would the compiler know that the clause never gets used?
I noticed that module.__allow_mark_as_deleted__ should have parens, since it's a function. When I added them (module.__allow_mark_as_deleted__()), the warning disappeared.
Expected behavior
The function clause is in fact in use, so wouldn't expect that warning.
The text was updated successfully, but these errors were encountered:
Thank you. Because of the missing parenthesis, we are inferring that it expects a map, and you never give it a map. One potential fix here is to improve the error message to say the types the clause is expecting, and then mention it is never invoked with matching types.
In other words, we are barking at the wrong tree (but we are correct in the barking).
@tmjoen how did you find it was missing parenthesis? Did you get a warning? I am wondering if we should simply change the message to say "this function is either unused or will emit warnings when invoked". I am worried printing the inferred types can be too confusing (because they can be quite complex).
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Elixir 1.19.0-dev (compiled with Erlang/OTP 27)
(running off main — be17d71)
Operating system
MacOS 14.5
Current behavior
I was testing the new parallel deps compilation in Elixir 1.19-dev main and looking at the deprecation warnings when I got this one:
This is the code:
It gets called from a
run_changeset
pipeline →maybe_mark_for_deletion(changeset, module)
My code is in a library and
run_changeset
gets called with user code, so how would the compiler know that the clause never gets used?I noticed that
module.__allow_mark_as_deleted__
should have parens, since it's a function. When I added them (module.__allow_mark_as_deleted__()
), the warning disappeared.Expected behavior
The function clause is in fact in use, so wouldn't expect that warning.
The text was updated successfully, but these errors were encountered: