tesla
tesla copied to clipboard
Dialyzer failing on Tesla (master)
Just cloned Tesla (commit 6388e3c) and ran mix dialyzer
on Elixir 1.16.0.
The following output:
Finding suitable PLTs
Checking PLT...
Dialyxir has deprecated plt_add_deps: :project in favor of apps_direct, which includes only runtime dependencies.
** (ArgumentError) errors were found at the given arguments:
* 2nd argument: not a tuple
(erts 14.2.1) :erlang.element(1, :mime)
(dialyxir 1.4.2) lib/dialyxir/project.ex:371: anonymous fn/1 in Dialyxir.Project.load_project_deps/1
(elixir 1.16.0) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.0) lib/map.ex:262: Map.new_from_enum/2
(dialyxir 1.4.2) lib/dialyxir/project.ex:371: Dialyxir.Project.load_project_deps/1
(dialyxir 1.4.2) lib/dialyxir/project.ex:342: anonymous fn/2 in Dialyxir.Project.include_deps/0
(dialyxir 1.4.2) lib/dialyxir/project.ex:321: Dialyxir.Project.include_deps/0
(dialyxir 1.4.2) lib/dialyxir/project.ex:53: Dialyxir.Project.cons_apps/0
@nathany-copia are you able to fix the situation yourself?
I can try.
Is apps_direct the right option? Default is app_tree
.
https://github.com/jeremyjh/dialyxir?tab=readme-ov-file#dependencies
Then it gets interesting -- I'll see if I can figure these out, but I do find dialyzer errors rather difficult to read.
lib/tesla/multipart.ex:94: Function add_file/2 has no local return
lib/tesla/multipart.ex:94: Function add_file/3 has no local return
lib/tesla/multipart.ex:106: The call 'Elixir.File':'stream!'(_path@1::binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | char(),binary() | []),[],2048) breaks the contract ('Elixir.Path':t(),'line' | pos_integer(),[stream_mode()]) -> 'Elixir.File.Stream':t()
Elixir 1.16.0 deprecated File.stream!(file, options, line_or_bytes)
So this line File.stream!(path, [], 2048)
should just be File.stream!(path, 2048)
. I've had to make the same change in my own code to resolve a similar Dialyzer error.
I'm not sure exactly how to do that while still supporting Elixir < 1.16.0 though. 🤔
FYI, the reason why I'm here trying this is because code that uses Tesla is seeing similar Dialyzer errors bubble up through the call stack in Elixir 1.16.