-
Notifications
You must be signed in to change notification settings - Fork 275
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
dialyzer issues with elixir 1.12.0 #549
Comments
I get this error as well. |
I don’t run Dialyzer as part of my workflow, so I would appreciate if someone could investigate this and send PRs. FWIW, the reason why we have Dialyzer warnings on TypeModule is because it does code generation, so it likely generates clauses that can never match for some types but it matches for others, and Dialyzer can see through those. Sometimes the proper fix is to add the generated: true to the quoted code. |
For everyone here: the hot fix is to add a file called [
{"deps/postgrex/lib/postgrex/type_module.ex"},
{"lib/postgrex/type_module.ex"}
] |
For some reason the previous hot fix did not work for me, I had to use a slightly different version. I wonder if this may be because the app I'm referring to is an umbrella app. Current fix: [
# temporary fix for https://github.com/elixir-ecto/postgrex/issues/549
~r/deps\/postgrex\/lib\/postgrex\/type_module.ex/,
~r/lib\/postgrex\/type_module.ex/
] |
The warning is accurate, in the sense that it says "an improper list is being constructed here" and one is - the only report I got with a sensible line number pointed to line 358:
Tracing where this That explains why the code works, since that function is totally fine with cons-ballon-animals. I'm still confused about why Dialyzer only complains about the clause on line 358, when there's another equally-improper-seeming list on line 362 🤔 |
This is all expected and improper lists are valid io lists, so it is just a matter of adding a @dialyzer annotation that says improper lists are expected? |
@josevalim the annotation is (IMO) a tool of last resort; I'm more curious about why code that has been in Postgrex for 5 years (the timestamp on the lines in Related to those lines, a question - in all three of these cases, the
|
I've created a demo repo that shows the issue - it appears to be triggered by using https://github.com/al2o3cr/pg_dialyzer_test Trying different versions with |
Bisecting through Could this be an "add enough metadata to make the error reportable, then the error appears" situation? |
Yup, that seems to be the case! |
@josevalim Confirmed with additional manual prodding - short-circuiting one line from that commit to instead always return
I was able to silence some of the low-hanging fruit (that has sensible line numbers) with a judiciously-placed |
Discovered
|
Addresses [elixir-ecto#549](elixir-ecto#549) by marking code that creates improper lists as `generated: true`.
Created #556 to resolve this. |
* Bump up Elixir & OTP to latest * Revert to version available as hex.pm image * Bump up base image + OTP & Elixir Hex.pm has published a new image, which has allowed me to release (https://github.com/etalab/transport-ops/releases/tag/elixir-1.12.1-erlang-24.0.3-alpine-3.13.3) a compatible image. * Fix base image reference * Trigger CI build * Update credo to latest and fix credo blockers * Fix postgrex-related Dialyzer warnings See elixir-ecto/postgrex#549 * Apply mix format * Remove warning during tests * Upgrade cowboy & ranch for OTP 24 compatibility (#1691) See https://ninenines.eu/docs/en/cowboy/2.9/guide/migrating_from_2.8/ This upgrades cowboy, cowlib, and also ranch. * Upgrade mochiweb to latest (OTP 24 compat) I had for now to work-around the lack of official hex.pm release (mochi/mochiweb#233). * Update Vex to master for Elixir 1.11 compat I also removed vex dependency for apps which did not depend on vex. * Bump up Elixir to 1.12.2 * Backport coveralls fixes from #1446 * Bump up coveralls * Fix credo warning & use fetch_env! instead of get for config * Skip credo issue for now * Fix regression after refactoring
I just tried to update a project to elixir 1.12.0 and dialyzer spits out these messages:
Has anyone here seen those?
The text was updated successfully, but these errors were encountered: