This makes it so we're always capturing delimiter metadata for sigils
instead of requiring the `token_metadata` option. This means that we can
now show the correct sigils in ExUnit diffs (and elsewhere) for code
examples.
We have recently changed the compiler to emit a warning
for each undefined function with a generic error at the
end saying the module could not be defined.
Unfortunately, some tools like IDEs and Phoenix Reloader
give higher priority to errors over warnings, which means
an error would be shown but without any actionable
information.
This commit changes it so the first undefined function is
an error and all following ones are warnings.
Before:
iex(1)> a = [flatten: 1]; import List, only: a
** (CaseClauseError) no case clause matching: {:only, {:a, [version: 0, line: 1], nil}}
(elixir 1.10.0-dev) src/elixir_import.erl:10: :elixir_import.import/4
After:
iex(1)> a = [flatten: 1]; import List, only: a
** (CompileError) iex:1: invalid :only option for import, expected value to be an atom :functions, :macros, or a list literal, got: a
(elixir 1.10.0-dev) src/elixir_import.erl:22: :elixir_import.import/4
Mix stores the compile_env in each applications' .app file.
Releases and Mix tasks were also changed to validate against
the runtime configuration against any stored `compile_env`.
In case of mismatches, an error is raised during boot.
Sometimes one undefined function warning can hide others.
For example, in a function call like this:
foo(bar 1, 2)
The user may be expecting it to be called as:
foo(bar(1), 2)
But Elixir compiles it to:
foo(bar(1, 2))
In this case, the warning would be one of "undefined
function foo/1" or "undefined function bar/2", but they
are only "half truths". By showing all undefined function
warnings, we improve errors like above and it allows
users to see all undefined calls at once, when it would
otherwise require them to compile the code multiple times.
Instead of incrementing the version for each variable individually we increment it globally for all variables. This means we can uniquely identify each variable assignment with only the version.
Fixes#9392.
When a local bodiless function is called the generated Erlang code is invalid, this commit checks for bodiless locals during the compilation and raises an error on that avoiding the invalid code.