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
We seem to use "pattern" to describe the thing that is doing the
matching, and "match" to describe the _found_ object. This is intended
to make this docs more consistent with the language found in the `Regex`
module.
Fixes#9659
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.
In the optimized case with a single-element list returned from the
`next_fun`, call the stream function chain in a separate try/catch
block. If it errors out, call the `after_fun` with the new accumulator
returned from `next_fun`.
Previously the `after_fun` was called with the old accumulator in such
case.
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.
When this happened, the last "|" became the content of the second to
last column.
This happened for example with the table in the Base module
## Base 64 (URL and filename safe) alphabet
...
12 | M | 29 | d | 46 | u | 63 | _
13 | N | 30 | e | 47 | v | | |
14 | O | 31 | f | 48 | w | (pad) | =
15 | P | 32 | g | 49 | x | | |
16 | Q | 33 | h | 50 | y | | |
Use:
- macOS, instead of MacOS X;
- Windows 7, instead of Win7
- Unix, instead of UNIX
- Unix-like operating system or Unix-like system, instead of just Unix