Hello everyone,
I receive the following error message from dialyxir.
lib/otp/worker_sup.ex:10: Function init/1 has no local return
lib/otp/worker_sup.ex:16: The call 'Elixir.Supervisor':init(Vchildren@1::[{_,_},...],Vopts@1::[{'strategy','simple_one_for_one'},...]) breaks the contract ([supervisor:child_spec() | {module(),term()} | module()],[init_option()]) -> {'ok',tuple()}
The code is as follow
defmodule Otp.WorkerSup do
use Supervisor
alias __MODULE__
@spec start_link(mfa()) :: {:ok, pid()} | {:error, term()}
def start_link({_, _, _} = mfa) do
Supervisor.start_link(WorkerSup, mfa, name: WorkerSup)
end
def init({m, _f, a}) do
children = [
{m, a}
]
opts = [strategy: :simple_one_for_one]
Supervisor.init(children, opts)
end
end
It is a simple supervisor for spawning workers.
I tried to fake a response, by adding {:ok, {}} at the end of the init function, but it does not change the error.
I am running this on Elixir 1.6 otp, Erlang 20.1
BTW the code is running fine, I just would like to know how to resolve dialyxir error message.
Any ideas?
Thanks for taking time