Closed thbar closed 2 years ago
My intuition is that it's unhappy that the expression passed to assert can never evaluate to nil or false, because instead of a comparison you are passing a non-refutable pattern match. So instead of nil/false you will get an exception, and the guard clause in the expanded macro will indeed never be used.
This isn't really a question about dialyxir
since its a question about the results of the analysis which isn't done in this project; but for it to be an OTP issue you'd have to reproduce it in valid Erlang. The best place to ask for help is the Elixir forum. You might have a tough time getting good results dialyzing tests just because almost no one does it, so idiomatic expressions may yield warnings that you can't solve.
Precheck
Environment
Current behavior
This code:
https://github.com/etalab/transport-site/blob/2c34dcd6d18a0d354b4697bec80a5136d7454303/apps/transport/test/support/s3_test_utils.ex#L14-L20
Leads to this warning:
Expected behavior
I was expecting it would work, even after looking a bit closer at how
exunit
handles matches (https://github.com/elixir-lang/elixir/blob/feb9884a3e7196aac6c8ba2132cb41515adb1c5e/lib/ex_unit/lib/ex_unit/assertions.ex#L84-L99), and switching fromrequire ExUnit.Assertions
toimport ExUnit.Assertions
.I wonder if my understanding is incorrect, or if this is a trouble in the
dialyzer
run, not very sure yet, but I thought it would be worth opening to discuss this here.