[erlang-bugs] Wrong warning when dispatching to a literal tuple

Jesper Louis Andersen <>
Fri Dec 13 10:58:08 CET 2013

The compiler currently seem to understand rather few variants:


where a,b are atoms and A,B are variables. Everything else is an invalid call and generates a warning. Which is correct Erlang, since tuple-funs is a hack in place to handle the parameterised module parse transform and other old stuff. Note the compiler still generates an `old_apply` in this case so it allows the code to “work”, but it warns about the problematic form.

fun (element(1, {hello, 1})):world/0

would probably work for generated code. It uses the more modern “fun M:F/A” form.

Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen

On 13 Dec 2013, at 09:25, José Valim <> wrote:

> The following code:
> -module(foo).
> -compile(export_all).
> sample() -> ({ hello, 1 }):world().
> Issues the following warning:
> foo.erl:4: Warning: invalid module and/or function name; this call will always fail
> Which is not true if there is a "hello" module defined.
> This issue has been reported here: http://stackoverflow.com/questions/20556472/elixir-protocols-in-erlang-a-strange-warning/20561973#20561973
> Thanks!
> José Valim
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Lead Developer
> _______________________________________________
> erlang-bugs mailing list
> http://erlang.org/mailman/listinfo/erlang-bugs

More information about the erlang-bugs mailing list