> I wonder if maybe a Credo check might be better suited for this rather than a 
> built-in compiler warning.

The point is that not all projects use Credo, and as pointed above, this issue 
is happening also in some "high-grade" applications (Phoenix). Also Credo 
checks can be quite slow, so not everyone is running it regularly, while 
running single test can be much faster.

The main reason why I think that it should be in ExUnit is that it can easily 
result in **wrong test**. It is not like `assert length(list) == 1` that still 
will be correct, just can be slow. It is not `a = %{a: 1}; b = %{a: 1, b: 2}; 
assert ^a = b` that will just fail as the match isn't exact. `assert %{} = 
value` is **dangerous** as it will silently allow any map without telling user 
that they have problem in their code until that will blow in their face in 
production.

That is the problem, this code will work, it will happily report success (even 
when user expected it to fail) and will work, until there will be change that 
will cause it to silently accept wrong result.

--

Łukasz Niemier
luk...@niemier.pl

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/9F86A2B9-9105-48E5-B2E2-F16F0B27683B%40niemier.pl.

Reply via email to