Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialyxir attempts to load transitive optional dependencies #502

Closed
kipcole9 opened this issue May 26, 2023 · 7 comments
Closed

Dialyxir attempts to load transitive optional dependencies #502

kipcole9 opened this issue May 26, 2023 · 7 comments
Assignees
Labels

Comments

@kipcole9
Copy link

Environment

  • Elixir & Erlang/OTP versions (elixir --version): Elixir 1.15.0-rc.0, OTP 26.0

  • Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir): 1.3.0

Current behavior

Dialyxir is issuing warnings that it can't load applications that are transitive optional dependencies. An example using the ex_cldr lib:

kip@Kips-MacBook-Pro cldr % asdf current
elixir          1.15.0-rc.0-otp-26 /Users/kip/Development/cldr/.tool-versions
erlang          26.0            /Users/kip/Development/cldr/.tool-versions
rust            stable          /Users/kip/.tool-versions
kip@Kips-MacBook-Pro cldr % mix dialyzer
Finding suitable PLTs
Checking PLT...
Error loading castore, dependency list may be incomplete.
 {~c"no such file or directory", ~c"castore.app"}
Error loading certifi, dependency list may be incomplete.
 {~c"no such file or directory", ~c"certifi.app"}
[:asn1, :castore, :certifi, :cldr_utils, :compiler, :crypto, :decimal, :earmark_parser, :eex, :elixir, :ex_doc, :ex_unit, :expo, :gettext, :inets, :jason, :kernel, :logger, :makeup, :makeup_elixir, :makeup_erlang, :mix, :nimble_parsec, :public_key, :ssl, :stdlib, :sweet_xml, :xmerl]
PLT is up to date!
ignore_warnings: .dialyzer_ignore_warnings

Starting Dialyzer
[
  check_plt: false,
  init_plt: ~c"/Users/kip/Development/cldr/_build/dev/dialyxir_erlang-26.0_elixir-1.15.0-rc.0_deps-dev.plt",
  files: [~c"/Users/kip/Development/cldr/_build/dev/lib/ex_cldr/ebin/Elixir.Cldr.LanguageTag.Chars.Cldr.LanguageTag.U.beam",
   ~c"/Users/kip/Development/cldr/_build/dev/lib/ex_cldr/ebin/Elixir.Cldr.Normalize.CalendarEra.beam",
   ~c"/Users/kip/Development/cldr/_build/dev/lib/ex_cldr/ebin/Elixir.Cldr.NoParentError.beam",
   ~c"/Users/kip/Development/cldr/_build/dev/lib/ex_cldr/ebin/Elixir.Cldr.UnknownFormatError.beam",
   ~c"/Users/kip/Development/cldr/_build/dev/lib/ex_cldr/ebin/Elixir.Mix.Tasks.Cldr.Install.Locales.beam",
   ...],
  warnings: [:unknown]
]
Total errors: 0, Skipped: 0, Unnecessary Skips: 0
done in 0m14.38s
done (passed successfully)

The libs :castore and :certifi are optional dependencies of cldr_utils. cldr_utils is a required dependency of ex_cldr.

The warning messages are unique to Elixir 1.15 / OTP 26.

I don’t see this output for any other combinations I’ve tried:

  • Elixir 1.15.0-rc.0-otp-25 with Erlang 25.3.2
  • Elixir 1.14.4-otp-26 with Erlang 26.0
  • Elixir 1.14.4-otp-25 with Erlang 25.3.2

Per this comment it seems reasonable that the addition of an optional_dependencies config key to .app files in OTP 24 and now the building of that config key in Elixir 1.15 may be part of the issue. The relevant code in dialyxir seems to be:

error("Error loading #{app}, dependency list may be incomplete.\n #{inspect(err)}")

Expected behavior

No warnings are issues when attempting to load transitive optional dependencies.

@jeremyjh
Copy link
Owner

@kipcole9 Thanks for the well-researched report, and thanks for your work on cldr & money. Will take a look.

@jeremyjh jeremyjh added the bug label May 26, 2023
@jeremyjh jeremyjh self-assigned this May 26, 2023
@tomtaylor
Copy link

Does anyone know if there's a workaround for this at the moment?

@dvic
Copy link

dvic commented Jul 5, 2023

Does anyone know if there's a workaround for this at the moment?

Not sure if this helps but linking from the original discussion: https://elixirforum.com/t/elixir-v1-15-0-rc-0-released/56019/28 the suggestion made by Jose:

When they traverse dependencies, they need to include the parent’s optional applications and not log an error if the dependency you cannot load is optional. But, from looking at the code, the warning causes no harm either.

@carlogilmar
Copy link

Hi! After upgrade a project with Elixir 1.15.0-otp-26 with Erlang 26.0.1, and after fix the problem with dialyzer (I had to include prune_code_paths: false in mix.exs), I got similar errors, dialyzer works, but I'm worried about all of this warnings:

image

@jeremyjh
Copy link
Owner

Fixed in #514

@kipcole9
Copy link
Author

Thank you very much @jeremyjh - and for maintaining such an important library. Really appreciated. Even if it still does my head in from time to time!

@jeremyjh
Copy link
Owner

Published to hex in 1.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants