chrisdel101
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.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
chrisdel101
I got it to work. The
@dializermacro (it is a marco right?) goes at the top the module in question. Then you must put in the correct erlang disable warning option.I had difficulty understanding the erlang docs, but the info was there the entire time. The warning options are these. I needed
no_matchSo I put this at the top of my file and the warnings are now ignored.
sabiwara
It is actually a module attribute, not a macro
Like macros, they are also compile-time.
chrisdel101
So I was correct in thinking I that was probably going to be wrong there
.
I still don’t really get all the terminology around here, but thanks for the link. It’ll help in fixing that.