I would like to know what I can do to get rid of the “incompatible types” warnings that are cluttering my phoenix server logs - I would willingly accept “operator error” as the cause if I could learn how to prevent the warnings. This is essentially the same as Destructuring a 2-tuple throws linter warning but still works. Incompatible types: tuple() !~ {var1, var2} - I am also using vscode and ElixirLS - in that post, one comment said that the problem would be fixed elixir 1.13 - I’m using 1.15. The phoenix app fine despite the warnings in the logs
Any help/direction is appreciated.
++++++++++++++++++++++++++
warning: incompatible types:
tuple() !~ {var1, var2, var3}
in expression:
# lib/dancePHX/dance_parser.ex:280
{ol, bts, d_bts} = acc
where “acc” was given the type tuple() in:
# lib/dancePHX/dance_parser.ex:278
elem(acc, 1)
where “acc” was given the type {var1, var2, var3} in:
# lib/dancePHX/dance_parser.ex:280
{ol, bts, d_bts} = acc
++++++++++++++++++++++++++
the code that’s generating this warning:
def _gen_phrases(el, acc) when elem(acc, 1) < 16 do <<<— line 278
[fig, b, _c] = el
{ol, bts, d_bts} = acc
...
end
There are also _gen_phrases(el, acc) functions using elem(acc, 1) == 16 and elem(acc, 1) > 16 which generate the same warning.
I’m using phoenix 1.6.11 and elixir 1.15.6.
++++++++++++++++++++++++++
$ elixir -v
Erlang/OTP 26 [erts-14.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Elixir 1.15.6 (compiled with Erlang/OTP 26)