valyukov
Dialyzer listed not implemented protocols as `Unknown functions`
I use protocols in my project. When I run mix dialyzer, it returns list of not implemented protocols in Unknown functions: section.
e.g.
'Elixir.Store.Protocols.Paycode.Atom':'__impl__'/1
does anybody know how to fix it?
Most Liked
jeremyjh
I use protocols in my project. When I run mix dialyzer, it returns list of not implemented protocols in Unknown functions: section.
FYI - thanks to @melpon - Dialyxir now supports a way to ignore known warnings.
OvermindDL1
My dyalizer output is run through sed to remove things I don’t want to see that upstream libraries have borked, definitely ugly. ^.^
im-tollu
@NobbZ, thanks!
Well, I used
def project do
...
consolidate_protocols: false
...
end
to switch off consolidation - and still get the same error.
Here is the ticket: https://github.com/elixir-lang/elixir/issues/7708
Eiji
Do you have your protocol implemented for Atom type?
If not and you don’t want to implement it you can try set @fallback_to_any and in the implementation for Any then return nil.
See this link for details of the protocols and implementation for Any.
If I understand it correctly this tool checks: “what will happen if someone run a protocol method with …”.
If you do not want to implement fallback you need to find a configuration/flag/option to disable missing protocol implementations.
Here you have specified how to use flags, but I don’t know if there is any to disable this warning.
Eiji
Hmm, I read some about this tool. It’s not a problem with @fallback_to_any.
On stackoverflow this line putted in protocol definition solved the problem
@dialyzer {:nowarn_function, __protocol__: 1}
but it’s not working for me.
Environment:
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10]
Elixir 1.3.4
Steps to reproduce:
- Install latest stable Elixir with it’s dependencies
- Create new project using:
mix newcommand. - Add:
{:dialyxir, "~> 0.3.5", only: [:dev]}to your example app dependencies list. - Run:
mix deps.getand:mix deps.compile - Add code from already solved stackoverflow thread.
- Prepare dialyzer, by executing:
mix dialyzer.plt - Run dialyzer:
mix dialyzer
Expected behaviour:
Dialyzer should not produce any warning messages.
Actual behaviour:
Dialyzer returned many warning (unknown functions) for Elixir protocol implementations: Atom, BitString, Float, Function, List, Map, PID, Port, Reference and Tuple.
What do you think about it @jeremyjh?







