1

我正在研究 Elixir,使用 Erlang 内置:httpc函数来执行获取请求。

if {:ok, {status, header, body}} = :httpc.request(:get, {img, []}, [], []) do
  # ...
end

功能运行良好。然后在运行 mix dialyzer 后,它返回错误:

:0:unknown_function
Function :httpc.request/4 does not exist.
________________________________________________________________________________
lib/vutuv/accounts.ex:301:guard_fail
Guard test:
_ :: {:ok, {_, _, _}}

===

false

can never succeed.
________________________________________________________________________________
done (warnings were emitted)

我放这行是为了告诉 Dialyzer 跳过检查该功能。

@dialyzer {:nowarn_function, get_gravatar: 2}

但是,错误仍然存​​在

:0:unknown_function
Function :httpc.request/4 does not exist.
________________________________________________________________________________
done (warnings were emitted)
4

1 回答 1

0

This is solved in https://elixirforum.com/t/dialyzer-does-not-know-httpc/21622/3

After adding :inets to the extra_applications in mix.exs, everything is passed successfully.

于 2019-04-14T04:12:36.450 回答