Phoenix and Dialyzer

603 views
Skip to first unread message

Jared Lewis

unread,
Sep 29, 2015, 10:01:21 PM9/29/15
to phoenix-talk
Hello,

So I have successfully used dialyzer on some small toy projects and was interested to try it with phoenix.

I created an empty phoenix project and ran dialyzer. It had the following output.

lib/phoenix/endpoint/render_errors.ex:1: Callback info about the 'Elixir.Plug' behaviour is not available

lib
/phoenix/router.ex:1: Callback info about the 'Elixir.Plug' behaviour is not available

lib
/phoenix/router.ex:250: The call _@4:'host'() requires that _@4 is of type atom() | tuple() not #{}

lib
/phoenix/router.ex:250: The call _@3:'path_info'() requires that _@3 is of type atom() | tuple() not #{}

lib
/phoenix/router.ex:250: The call _@2:'method'() requires that _@2 is of type atom() | tuple() not #{}

lib
/phoenix/router.ex:255: The call _@2:'private'() requires that _@2 is of type atom() | tuple() not #{}

lib
/type_test/repo.ex:1: Callback info about the 'Elixir.Ecto.Repo' behaviour is not available

web
/controllers/page_controller.ex:1: Callback info about the 'Elixir.Plug' behaviour is not available

web
/controllers/page_controller.ex:1: The call 'Elixir.Phoenix.Controller':put_new_layout(_@3::#{},{'Elixir.TypeTest.LayoutView','app'}) breaks the contract ('Elixir.Plug.Conn':t(),{atom(),binary()} | 'false') -> 'Elixir.Plug.Conn':t()

web
/controllers/page_controller.ex:2: The call _@4:'params'() requires that _@4 is of type atom() | tuple() not #{}

web
/router.ex:12: Function api/2 will never be called

Am I doing something wrong or does Phoenix not support dialyzer? If it is no supported, are there plans to one day support it?

Thanks!

webengi...@gmail.com

unread,
Oct 7, 2015, 12:45:15 AM10/7/15
to phoenix-talk
Hi, 

try adding missed apps to PLT first (see http://www.erlang.org/doc/apps/dialyzer/dialyzer_chapter.html#id56795 for details):

1) find application

iex(1)> :code.lib_dir :plug
'/home/user/test/_build/dev/lib/plug'

2) add ebin subfolder to PLT

$user> dialyzer --add_to_plt /home/user/test/_build/dev/lib/plug/ebin

Proceed with :ecto and :phoenix apps then.
Reply all
Reply to author
Forward
0 new messages