v1.16.0
Official announcement: https://elixir-lang.org/blog/2023/12/22/elixir-v1-16-0-released/
1. Enhancements
EEx
- [EEx] Include relative file information in diagnostics
Elixir
- [Code] Add
:emit_warningsforCode.string_to_quoted/2 - [Code] Automatically include columns in parsing options
- [Code] Introduce
MismatchedDelimiterErrorfor handling mismatched delimiter exceptions - [Code.Fragment] Handle anonymous calls in fragments
- [Code.Formatter] Trim trailing whitespace on heredocs with
\r\n - [File] Add
:offsetoption toFile.stream!/2 - [Kernel] Auto infer size of matched variable in bitstrings
- [Kernel] Preserve column information when translating typespecs
- [Kernel] Suggest module names based on suffix and casing errors when the module does not exist in
UndefinedFunctionError - [Kernel.ParallelCompiler] Introduce
Kernel.ParallelCompiler.pmap/2to compile multiple additional entries in parallel - [Kernel.SpecialForms] Warn if
True/False/Nilare used as aliases and there is no such alias - [Macro] Add
Macro.compile_apply/4 - [Module] Add support for
@nifsannotation from Erlang/OTP 25 - [Module] Add support for missing
@dialyzerconfiguration - [String] Update to Unicode 15.1.0
- [String] Add
String.replace_invalid/2 - [Task] Add
:limitoption toTask.yield_many/2
Logger
- [Logger] Add
Logger.levels/0
Mix
- [mix] Add
MIX_PROFILEto profile a list of comma separated tasks - [mix archive.install] Support
--sparseoption - [mix compile.app] Warn if both
:applicationsand:extra_applicationsare used - [mix compile.elixir] Pass original exception down to diagnostic
:detailswhen possible - [mix compile.elixir] Optimize scenario where there are thousands of files in
lib/and one of them is changed - [mix deps.clean] Emit a warning instead of crashing when a dependency cannot be removed
- [mix escript.install] Support
--sparseoption - [mix release] Include
include/directory in releases - [mix test] Allow testing multiple file:line at once, such as
mix test test/foo_test.exs:13 test/bar_test.exs:27
2. Bug fixes
Elixir
- [Code] Keep quotes for atom keys in formatter
- [Code.Fragment] Fix crash in
Code.Fragment.surround_context/2when matching on-> - [IO] Raise when using
IO.binwrite/2on terminated device (mirroringIO.write/2) - [Kernel] Do not expand aliases recursively (the alias stored in Macro.Env is already expanded)
- [Kernel] Ensure
dbgmodule is a compile-time dependency - [Kernel] Warn when a private function or macro uses
unquote/1and the function/macro itself is unused - [Kernel] Re-enabled compiler optimizations for top level functions in scripts (disabled in v1.14.0 but shouldn't impact most programs)
- [Kernel] Do not define an alias for nested modules starting with
Elixir.in their definition - [Kernel.ParallelCompiler] Consider a module has been defined in
@after_compilecallbacks to avoid deadlocks - [Macro] Address exception on
Macro.to_string/1for certain ASTs - [Path] Lazily evaluate
File.cwd!/0inPath.expand/1andPath.absname/1 - [Path] Ensure
Path.relative_to/2returns a relative path when the given argument does not share a common prefix withcwd
ExUnit
- [ExUnit] Raise on incorrectly dedented doctests
IEx
- [IEx.Pry] Fix prying functions with only literals in their body
Mix
- [mix archive.install] Restore code paths after
mix archive.install - [mix compile] Ensure files with duplicate modules are recompiled whenever any of the files change
- [mix compile] Update Mix compiler diagnostics documentation and typespecs to match the Elixir compiler behaviour where both lines and columns start from one (before it inaccurately said that columns started from zero)
- [mix escript.install] Restore code paths after
mix escript.install
3. Soft deprecations (no warnings emitted)
Elixir
- [File] Deprecate
File.stream!(file, options, line_or_bytes)in favor of keeping the options as last argument, as inFile.stream!(file, line_or_bytes, options) - [Kernel.ParallelCompiler] Deprecate
Kernel.ParallelCompiler.async/1in favor ofKernel.ParallelCompiler.pmap/2 - [Path] Deprecate
Path.safe_relative_to/2in favor ofPath.safe_relative/2
Mix
- [mix compile] Returning a four-element tuple as a position in
Mix.Task.Compiler.Diagnostic
4. Hard deprecations
Elixir
- [Date] Deprecate inferring a range with negative step, call
Date.range/3with a negative step instead - [Enum] Deprecate passing a range with negative step on
Enum.slice/2, givefirst..last//1instead - [Kernel]
~R/.../is deprecated in favor of~r/.../. This is because~R/.../still allowed escape codes, which did not fit the definition of uppercase sigils - [String] Deprecate passing a range with negative step on
String.slice/2, givefirst..last//1instead
ExUnit
- [ExUnit.Formatter] Deprecate
format_time/2, useformat_times/1instead
Mix
- [mix compile.leex] Require
:leexto be added as a compiler to run theleexcompiler - [mix compile.yecc] Require
:yeccto be added as a compiler to run theyecccompiler