I recently upgraded a project from phx from 1.4 to 1.6 and am seeing the same dialyzer warnings for each of my _view.exs files.
lib/bond_web/views/integration_view.ex:2:no_return
Function template_not_found/2 has no local return.
________________________________________________________________________________
lib/bond_web/views/layout_view.ex:2:no_return
Function template_not_found/2 has no local return.
________________________________________________________________________________
lib/bond_web/views/page_view.ex:2:no_return
Function template_not_found/2 has no local return.
________________________________________________________________________________
done (warnings were emitted)
I decompiled my page_view module and I saw it had the following, which makes the dialyzer warnings 100% on point:
This in turn suggests a default implementation is inserted which throws doesn’t seem to care about ErrorView unless something catches the error raised before delegating back to error view…
I understand <WebApp>.ErrorView.template_not_found/2 is the fallback action for all views(?).
defmodule BondWeb.ErrorView do
use BondWeb, :view
def template_not_found(template, _assigns) do
Phoenix.Controller.status_message_from_template(template)
end
end
Either way, is this warning from dialyzer going to need to be appeased by adding the default implementation in which mimics or delegates to the ErrorView generated function?
Had the same problem, all my view modules generated a warning.
Did a mix deps.update --all which updated phoenix_view from 1.1.1 to 1.1.2 and the warnings disappeared.
Not sure that phoenix_view version is the problem, but updating did fix it for me.