Dialyzer and `with` statements with inspect calls (inside a function)

Hello,

I’m scratching my head around a The created fun has no local return dialyzer warning when an inspect call is done inside a with statement

I’ve setup a sample repo here: https://github.com/xadhoom/local_return and dialyzer will blame me about https://github.com/xadhoom/local_return/blob/master/lib/local_return.ex#L15

Basically, when the match fails and the else block will kick in as expected, so the code seems correct to me.

If the inspect is removed, it works ok.
If the inspect is put outside the function block, it works.
If the inspect “inspects” a value and not a variable, it works.

So basically an inspect call over a variable inside a function inside a with block will make dialyzer not happy.

what I’m missing?

another dialyzer warn: if the else block contains a specific match and a catch all one, it warns about The variable _ can never match since previous clauses completely covered the type.....

I’ve updated the example to add this case.

I’m really lost :smiley:

ignore last one, the dialyzer is correct.

so only the inspect calls have something broken.

Seems that happens only with elixir 1.5.0, with 1.4.5 is ok.

maybe a bug?

The github issue: https://github.com/elixir-lang/elixir/issues/6378

1 Like