If the code during compile phase conditionally relies on some config, the typing validation would yell at us while compiling. Consider the following code
defmodule TypeTest do
foo = Application.compile_env(:my_app, :param, true)
defp fun(arg) do
case unquote(foo) do
false -> {:error, arg}
true -> {:ok, arg}
end
end
end
the compilation warns out with
warning: the following clause will never match:
false
because it attempts to match on the result of:
true
which has type:
true
Unfortunately, the famous trick to fool dialyzer does not obviously work here.
case :erlang.phash2(1, 1) do
0 -> …
end
Any idea of how I could have this warning suppressed? In my opinion, the above is more or less common usecase and the warning there is unlikely helpful.