|
1 | 1 | # Changelog for Elixir v1.16 |
2 | 2 |
|
| 3 | +## Code snippets in diagnostics |
| 4 | + |
| 5 | +Elixir v1.15 introduced a new compiler diagnostic format and the ability to print multiple error diagnostics per compilation (in addition to multiple warnings). |
| 6 | + |
| 7 | +With Elixir v1.16, we also include code snippets in exceptions and diagnostics raised by the compiler. For example, a syntax error now includes a pointer to where the error happened: |
| 8 | + |
| 9 | +``` |
| 10 | +** (SyntaxError) invalid syntax found on nofile:1:17: |
| 11 | + error: syntax error before: '*' |
| 12 | + │ |
| 13 | + 1 │ [1, 2, 3, 4, 5, *] |
| 14 | + │ ^ |
| 15 | + │ |
| 16 | + └─ lib/my_app.ex:1:17 |
| 17 | +``` |
| 18 | + |
| 19 | +For mismatched delimiters, it now shows both delimiters: |
| 20 | + |
| 21 | +``` |
| 22 | +** (MismatchedDelimiterError) mismatched delimiter found on nofile:1:18: |
| 23 | + error: unexpected token: ) |
| 24 | + │ |
| 25 | + 1 │ [1, 2, 3, 4, 5, 6) |
| 26 | + │ │ └ mismatched closing delimiter (expected "]") |
| 27 | + │ └ unclosed delimiter |
| 28 | + │ |
| 29 | + └─ lib/my_app.ex:1:18 |
| 30 | +``` |
| 31 | + |
| 32 | +Errors and warnings diagnostics also include code snippets. When possible, we will show precise spans, such as on undefined variables: |
| 33 | + |
| 34 | +``` |
| 35 | + error: undefined variable "unknown_var" |
| 36 | + │ |
| 37 | +5 │ a - unknown_var |
| 38 | + │ ^^^^^^^^^^^ |
| 39 | + │ |
| 40 | + └─ lib/sample.ex:5:9: Sample.foo/1 |
| 41 | +``` |
| 42 | + |
| 43 | +Otherwise the whole line is underlined: |
| 44 | + |
| 45 | +``` |
| 46 | +error: function names should start with lowercase characters or underscore, invalid name CamelCase |
| 47 | + │ |
| 48 | +3 │ def CamelCase do |
| 49 | + │ ^^^^^^^^^^^^^^^^ |
| 50 | + │ |
| 51 | + └─ lib/sample.ex:3 |
| 52 | +``` |
| 53 | + |
| 54 | +## Revamped documentation |
| 55 | + |
| 56 | +TODO: Guides, diagrams, anti-patterns, cheatsheets. |
| 57 | + |
3 | 58 | ## v1.16.0-dev |
4 | 59 |
|
5 | 60 | ### 1. Enhancements |
6 | 61 |
|
| 62 | +#### EEx |
| 63 | + |
| 64 | + * [EEx] Include relative file information in diagnostics |
| 65 | + |
| 66 | +#### Elixir |
| 67 | + |
| 68 | + * [Code] Automatically include columns in parsing options |
| 69 | + * [Code] Introduce `MismatchedDelimiterError` for handling mismatched delimiter exceptions |
| 70 | + * [Code.Fragment] Handle anonymous calls in fragments |
| 71 | + * [Kernel] Suggest module names based on suffix and casing errors when the module does not exist in `UndefinedFunctionError` |
| 72 | + * [Kernel.ParallelCompiler] Introduce `Kernel.ParallelCompiler.pmap/2` to compile multiple additional entries in parallel |
| 73 | + * [Macro] Add `Macro.compile_apply/4` |
| 74 | + * [String] Update to Unicode 15.1.0 |
| 75 | + |
7 | 76 | ### 2. Bug fixes |
8 | 77 |
|
9 | 78 | #### Elixir |
10 | 79 |
|
11 | 80 | * [IO] Raise when using `IO.binwrite/2` on terminated device (mirroring `IO.write/2`) |
| 81 | + * [Kernel] Do not expand aliases recursively (the alias stored in Macro.Env is already expanded) |
| 82 | + * [Kernel] Ensure `dbg` module is a compile-time dependency |
| 83 | + * [Kernel] Warn when a private function or macro uses `unquote/1` and the function/macro itself is unused |
12 | 84 | * [Path] Ensure `Path.relative_to/2` returns a relative path when the given argument does not share a common prefix with `cwd` |
13 | 85 |
|
| 86 | +#### ExUnit |
| 87 | + |
| 88 | + * [ExUnit] Raise on incorrectly dedented doctests |
| 89 | + |
14 | 90 | ### 3. Soft deprecations (no warnings emitted) |
15 | 91 |
|
| 92 | +#### Elixir |
| 93 | + |
| 94 | + * [Kernel.ParallelCompiler] Deprecate `Kernel.ParallelCompiler.async/1` in favor of `Kernel.ParallelCompiler.pmap/2` |
16 | 95 | * [Path] Deprecate `Path.safe_relative_to/2` in favor of `Path.safe_relative/2` |
17 | 96 |
|
18 | 97 | ### 4. Hard deprecations |
|
0 commit comments