After reading Dialyzer: suppress warning on a specific function, I think I know what I need but I don’t know where to put it.
I get a warning that is just wrong. It’s on code that runs and is often accessed, i.e. a major piece of the codebase. I have this warning in a few other places too where it should not be, and nothing I do gets rid if of it.
The pattern can never match the type.
Pattern:
{:error, _error}
Type:
{:ok, <<_::296>> | map()} | {:error, map(), number()}
I think I can use this to silence it, but where does it go?
Should be maybe @dialyzer {:Wno_match, handle_event/3}
@dialyzer {:Wno_match, handle_event: 3}
I put it at the top of the module and I get the error: undefined variable "handle_event"
invalid value for @dialyzer attribute: {:Wno_match, [handle_event: 3]}
I guess I’m using to wrong also, hence the invalid value, but the docs are quite dense.
This is just the default LiveView handle_event
.
PS: this the demo line for how to use this, but it makes no sense to me.
defmodule Myapp.Repo do
use Ecto.Repo, otp_app: :myapp
@dialyzer {:nowarn_function, rollback: 1}
end
Let’s start with where in the file this goes. Then we’ll handle the invalid value
issue which has sprung up as I posted this.