Fix funs error: no match of right hand side value: nil#73
Merged
sasa1977 merged 2 commits intosasa1977:masterfrom Jul 15, 2025
Merged
Fix funs error: no match of right hand side value: nil#73sasa1977 merged 2 commits intosasa1977:masterfrom
funs error: no match of right hand side value: nil#73sasa1977 merged 2 commits intosasa1977:masterfrom
Conversation
I encountered error running `funs` command in a module like this: ```elixir defmodule MyApp.Mailer do use Boundary, deps: [], exports: [] use Swoosh.Mailer, otp_app: :my_app end ``` The fallback in this commit allows `funs` mix command to run successfully.
funs error: no match of right hand side value: nil
sasa1977
reviewed
Jul 12, 2025
Comment on lines
44
to
51
| {caller_fun, _arity} = | ||
| case env.function do | ||
| nil -> {:__module__, 0} # fallback name for non-function scope | ||
| tuple -> tuple | ||
| end | ||
|
|
||
| if inspect(env.module) == :persistent_term.get({__MODULE__, :module}) and caller_fun != callee_fun, | ||
| do: :ets.insert(__MODULE__, {caller_fun, callee_fun}) |
Owner
There was a problem hiding this comment.
I wonder if instead of {:__module__, 0} we should simply ignore this case, so basically:
with {caller_fun, _arity} <- env.function,
true <- inspect(env.module) == :persistent_term.get({__MODULE__, :module}),
true <- caller_fun != callee_fun,
do: :ets.insert(...)
:ok
Contributor
Author
There was a problem hiding this comment.
Ah... yes, better than faking the function name.
Avoid inserting trace when `env.function` is nil
gaggle
commented
Jul 14, 2025
Comment on lines
43
to
49
| def trace({local, _meta, callee_fun, _arity}, env) when local in ~w/local_function local_macro/a do | ||
| {caller_fun, _arity} = env.function | ||
|
|
||
| if inspect(env.module) == :persistent_term.get({__MODULE__, :module}) and caller_fun != callee_fun, | ||
| do: :ets.insert(__MODULE__, {caller_fun, callee_fun}) | ||
| with {caller_fun, _arity} <- env.function, | ||
| true <- inspect(env.module) == :persistent_term.get({__MODULE__, :module}), | ||
| true <- caller_fun != callee_fun, | ||
| do: :ets.insert(__MODULE__, {caller_fun, callee_fun}) | ||
|
|
||
| :ok |
Contributor
Author
There was a problem hiding this comment.
@sasa1977 now ignoring the case, per your suggested implementation 👍
Owner
|
Thank you! |
Contributor
Author
|
Hi @sasa1977, I can confirm the fix works. May I inquire if this fix is scheduled for a release? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I encountered error:
This was due to a module like this:
The fallback in this commit allows
funsmix command to run successfully.