Dialyzer issue with Phoenix 1.4.15

Hey all!

Dialyzer has been throwing an error recently when bumping Phoenix to 1.4.15. Curious if anyone else is seeing this and if there are any fixes.

Here’s what we’re seeing.

** (throw) {:error, :parsing, [{:"<<", 1}, {:<, 1}, {:_, 1}, {:":", 1}, {:int, 1, 48}, {:">>", 1}, {:",", 1}, {:atom_full, 1, '\'false\''}, {:>, 1}]}
    lib/erlex.ex:59: Erlex.parse/1
    lib/erlex.ex:85: Erlex.pretty_print/1
    lib/erlex.ex:172: Erlex.pretty_print_type/1
    lib/dialyxir/warnings/pattern_match.ex:11: Dialyxir.Warnings.PatternMatch.format_short/1
    lib/dialyxir/formatter.ex:71: Dialyxir.Formatter.format_warning/2
    lib/dialyxir/formatter.ex:209: Dialyxir.Formatter.filter_warning/3
    (elixir 1.10.1) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    lib/dialyxir/formatter.ex:199: Dialyxir.Formatter.filter_warnings/3
2 Likes

What version of dialyxir are you using and what is the raw dialyzer error?

I’m using 1.0.0-rc.7 of dialyxir.

I don’t think there is a raw dialyzer error. Looks like it’s throwing an error rather than reporting results from dialyzer. Let me know if that doesn’t seem right.

Looks like it’s likely a bug in erlex or dialyxir. Can you reproduce it on a fresh Phoenix project?

My assumption is, that the translator between dialyzers output in erlang syntax and the reported output in elixir syntax is throwing up, so that error message needs to be analised to find the place its comming from to report the bug back to dialyzer and its dependencies.

So in your project, whats the output of mix dialyxir --format raw (and also mix dialyxir --format dialyzer).

Neither command provides a different output.

This comes from the router file, apparently. I am getting a similar error on my end. Besides the Erlex bug, there’s a bug in Dialyxir’s filtering that is assuming all the short errors can be printed appropriately for filtering but that is an invalid assumption (I think I wrote that bug…). Then combined with the Phoenix router bug we have all sorts of fun here.

{:warn_matching, {'lib/your_app/router.ex', 1}, {:pattern_match, ['pattern <_@1, _@2 = \'true\'>', '<<<_:8,_:_*1>>,\'false\'>']}}

is the legacy warning being emitted.

3 Likes

Are there any workarounds?

I’m actively investigating this all on my end so I will hopefully have one soon.

2 Likes

See https://github.com/jeremyjh/dialyxir/issues/383 if you want to help submit a fix!

2 Likes

Downgrading to Phoenix 1.4.14 makes the error go away. Many issues will be filed on account of this bug.

I made a note of this on your issue in GitHub.

Thanks for filing!

1 Like

See https://github.com/phoenixframework/phoenix/issues/3697 for Phoenix bug

2 Likes

@asummers how did you get the underlying dialyzer warning?

Modified the offending calls in Dialyxir to bypass the offending Erlex call. Not my best debugging, but it worked. The other option would be to drop back to a non-Erlex Dialyxir so you get the old style warnings.

1 Like

This is now also fixed in Erlex 0.2.6. Thanks for playing, all!

3 Likes

Thanks for getting on this @asummers!