Elixir compiler unexpectedly omits warnings

Hello. I found out that in some cases Elixir compiler unexpectedly omits warnings in case of macro usage. Example:

file hello.ex

defmodule Hello do
  defmacro world do
    quote location: :keep do
      defmodule World do
        def foo(bar), do: nil

and then in file world.ex

import Hello

then mix compile gives 0 warnings - in this simple example I expected warning for unused variable, but it probably omits other warnings as well.

Have you tried mix compile --verbose ?

It may also be that the code is already compiled, has already emitted the error, and you need to recompile with --force to force it to redo the compilation.

1 Like

Yes, output is without warnings as well

Iljas-iMac:hello timcf$ elixir -v
Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.8.1 (compiled with Erlang/OTP 21)
Iljas-iMac:hello timcf$ mix clean
Iljas-iMac:hello timcf$ mix compile --verbose --force
Compiling 2 files (.ex)
Compiled lib/hello.ex
Compiled lib/world.ex
Generated hello app
Consolidated List.Chars
Consolidated Collectable
Consolidated Enumerable
Consolidated String.Chars
Consolidated IEx.Info
Consolidated Inspect
Iljas-iMac:hello timcf$