Releases: elixir-lang/elixir
Releases · elixir-lang/elixir
v1.3.0
Official announcement: https://elixir-lang.org/blog/2016/06/21/elixir-v1-3-0-released/
1. Enhancements
EEx
- [EEx.Engine] Support an
init/1function in engines that will return the initial buffer (defaults to an empty string)
Elixir
- [Access] Add support for
Access.all/0,Access.elem/1,Access.key/2andAccess.key!/1for traversing nested data structures - [Calendar] Add
CalendarandDate,Time,NaiveDateTimeandDateTimetypes - [CLI] Add
--logger-otp-reports BOOLand--logger-sasl-reports BOOLswitches - [Compiler] Emit a summary of compilation errors when modules are missing
- [Enum] Add
Enum.group_by/3that allows developers to map on the value being grouped - [Enum] Make list values in maps returned by
Enum.group_by/2andEnum.group_by/3preserve the order of the input enumerable instead of reversing it. - [Enum] Add
Enum.drop_every/2that drops everynth, including the first one - [Exception] Suggest possible functions on
UndefinedFunctionErrorfor existing modules - [Exception] Warn if unknown fields are given to
raise/2 - [File] Support IO devices in
File.copy/3 - [GenServer] Raise a more meaningful exit if you try to
GenServer.call/3yourself - [Inspect] Support
:baseoption when inspecting binaries - [IO] Add
IO.warn/2that will print a warning message with stacktrace and notify the compiler a warning was printed (in case --warnings-as-errors was enabled) - [Kernel] Support
generated: truein quote - [Kernel] Support
Kernel.pop_in/1andKernel.pop_in/2for yanking a value from a nested data structure - [Kernel] Allow variable struct names when matching, for example,
%module{key: "value"} = struct - [Kernel] Allow guards on the left side of
<-inforandwithspecial forms - [Kernel] Support
elsechunks inwith - [Kernel] Track
{module, function, arity}imports and warn on unused ones when such are specified in:only - [Kernel] Add
keyword/0andkeyword/1built-in types to typespecs - [Kernel] Add sigils for date (
~D[2015-04-17]), time (~T[08:00:00]) and naive date times~N[2015-04-17 08:00:00] - [Kernel] Support
@enforce_keysondefstruct/1to guarantee some keys are explicitly given when building structs - [OptionParser] Add support for
:countswitch type - [OptionParser] Add
parse!/2andparse_head!/2that raiseOptionParser.ParseErrorin case of errors - [Process] Add
Process.sleep/1 - [Range]
Range.range?/1now checks the validity of a range. - [Regex] Support
:include_capturesinRegex.split/3 - [String] Add
String.myers_difference/2for calculating the difference between two strings - [System] Add
System.os_time/0andSystem.os_time/1 - [Typespec] Add support for
%{required(foo) => bar}and%{optional(foo) => bar}forms (Erlang 19 only) - [Typespec] Add support for
@optional_callbacksto mark certain that certain callbacks may be optionally implemented - [Typespec] Introduce
%{...}to mean any map (Erlang 19 only) - [URI] Add
URI.merge/2 - [Version] Add
Version.parse!/1
ExUnit
- [ExUnit] Show pinned variables on failed
assert ^left = rightandassert match?(^left, right)assertions - [ExUnit] Add
ExUnit.Case.register_attributewhich allow attributes to be cleaned up whenever a test is defined - [ExUnit] Add
ExUnit.Case.register_testand support the ability to tag "tests" by type. This will allow projects like QuickCheck to change the wording in formatters to say "10 properties" instead of "10 tests" - [ExUnit] Support diffing of values when using
==inassert - [ExUnit] Start running tests as soon as cases are loaded. This feature is enabled by default when running tests through Mix
- [ExUnit] Raise a straight-forward error message in case a duplicate test name is defined
- [ExUnit] Bump the default number of max cases to double of schedulers to support both IO and CPU bound tests
- [ExUnit] Support for named setups in
setupandsetup_all - [ExUnit] Support for bundling tests together with
describe/2
IEx
- [IEx] Add
nl/2that loads a given module on a list of nodes - [IEx.Helpers] No longer restart applications on
recompile/1 - [IEx.Autocomplete] Improve IEx expand to handle functions after
&
Logger
- [Logger] Introduce
Logger.reset_metadata/0,1
Mix
- [Mix] Add
mix xrefandmix compile.xrefthat runs cross-reference checks, with the latter running after compilation by default - [Mix] Add
mix app.treeandmix deps.tree - [Mix] Add
Mix.Task.rerun/2that reenables and re-runs a task - [Mix] Integrate
OptionParser.ParseErrorinto Mix, automatically converting such exceptions intoMix.Errorand embedding the task information - [Mix] Support
@preferred_cli_envattribute when defining tasks - [Mix] Support
mix test --raisethat will raise when a test suite fails (instead of setting the exit code to 1) - [Mix] Enable rebar3 manager by default for Hex dependencies
- [Mix] Add
mix escript.installto install escripts - [Mix] Print stacktraces for
Mix.ErrorwhenMIX_DEBUG=1is set - [Mix] Add a user friendly error for merge conflicts on
mix.lock - [Mix] Track files between path dependencies. This means umbrella applications will no longer trigger full recompilation when a sibling changes. Instead it will only recompile the files affected by the sibling changes
- [Mix] No longer print every file being compiled. Instead a generic "Compiling N files (.ext)" will be printed and files will only be logged in case they take more than 5 seconds to compile. This threshold can be customized by passing the
--long-compilation-thresholdflag and the previous behaviour can be reenabled by giving--verbosetomix compile - [Mix] Add
mix test --stalethat uses static analysis on source files to know which tests should run when source files changes. If any test file changes, it will also re-run. Changing a configuration file or the test helper will trigger a full recompilation
2. Bug fixes
Elixir
- [Application] Ensure
Application.spec/2returns nil for unknown applications - [GenServer] Ensures
cast/2returns:okif locally registered process is not found - [Inspect] Ensure binaries break into new lines when inspected
- [Kernel] Do not choke on capture operator with argument above
&191 - [Kernel] Raise if
defstructis called multiple times - [Kernel] Ensure
Module.create/3respects var/alias hygiene - [Kernel] Support non-literal ranges on the right side of
in/2 - [Macro] Fix
Macro.to_string/1on a call of a capture argument, for example&(&1).(:x) - [OptionParser] Allow
OptionParserto parse negative numbers - [Record] Fix
Record.is_record/2when dealing with non-record tuples - [String] Ensure
stripalso removes non-breaking whitespaces (and ensuresplitstill does not split on them) - [URI] Use square brackets for IPv6 in
URI.to_string/1
Mix
- [Mix] Improve task not found message when Mix would include the not found task as a suggestion due to different casing
- [Mix] Ignore lock revision when the lock is out of date when updating Mix dependencies. Before this fix, Git tags and branches in the lock file would erroneously take higher precedence than the one in
mix.exs - [Mix] Only recompile empty Elixir files if they change instead of recompiling them on every run
- [Mix] Ensure .app file is written in UTF-8 (this allows app descriptions to contain UTF-8 characters)
- [Mix.Dep] Always specify the
:envoption internally for dependencies to avoid false positives in the dependency resolution - [Mix.Dep] Correctly detect conflict from cousin optional dependencies in the dependency resolution algorithm
3. Soft deprecations (no warnings emitted)
- [Float]
Float.to_string/2andFloat.to_char_list/2has been soft-deprecated as Elixir will now attempt to print the shortest and most accurate representation by default. Developers can always fallback to:erlang.float_to_binary/2and:erlang.float_to_list/2if they need the previous functionality - [Kernel]
to_char_listfunctions have been soft-deprecated in favor ofto_charlist. This aligns with the naming conventions in both Erlang and Elixir - [String] The confusing
String.strip/2,String.lstrip/2andString.rstrip/2API has been soft deprecated in favor ofString.trim/2,String.trim_leading/2andString.trim_trailing/2 - [String] The confusing
String.ljust/3andString.rjust/3API has been soft deprecated in favor ofString.pad_leading/3andString.pad_trailing/3 - [Typespec]
char_listis soft-deprecated in favor ofcharlist
4. Deprecations
This release deprecates many APIs that have been soft-deprecated in previous Elixir versions.
Elixir
- [Dict]
Dictis no longer a behaviour and its functions will be deprecated in upcoming releases - [Enum] Passing a dictionary to
Enum.group_by/3is deprecated - [Kernel]
\x{H*}in strings/sigils/charlists is deprecated - [Kernel] Add deprecation for
defdelegatelist arguments and:append_firstoption. The previously undocumented and deprecated support for matching has been removed - [Kernel] Warn if a variable is assigned inside
case/if/etc and used outside the block - [Keyword]
Keyword.size/1is deprecated in favor ofKernel.length/1 - [Map]
Map.size/1is deprecated in favor ofKernel.map_size/1 - [Regex] The option
/r(for ungreedy) has been deprecated in favor of/U - [Set]
Setis no longer a behaviour and its functions will be deprecated in upcoming releases - [String]
String.valid_character?/1is deprecated in favor ofString.valid?/1with pattern matching - [Task]
Task.find/2is deprecated in favor of explicit message matching - [URI] Passing a non-map to
URI.decode_query/2is deprecated
v1.3.0-rc.1
Release v1.3.0-rc.1
v1.2.6
1. Enhancements
- [Kernel] Support Erlang 19
- [Kernel] Supported generated: true in the
quotespecial form
2. Bug fixes
- [Path] Fix a bug in path join with "/" followed by empty segments
- [String] Fix a bug in NFD normalization when followed by one-byte sized graphemes
- [Typespec] Correctly support
<<_::size, _::_*unit>>syntax
v1.3.0-rc.0
Release v1.3.0-rc.0
v1.2.5
Bug fixes
- [Logger] Stringify truncated function data in Logger
- [Logger] Ensure poorly formatted char data can also be logged by using the replacement character "�" (diamond question mark)
- [Mix] Do not assume
@implis always a list - [String] Fix bugs in
String.replace_*functions where it would not include the accumulated value for certain replacements
v1.2.4
Enhancements
- [Mix] Add
:archivesconfiguration todef projectthat allows projects to list archive dependencies.--no-archives-check(as well as--no-deps-check) will disable the archive check. The:archivesoption is not checked for dependencies. - [Mix] Add
deps.precompiletask as hook - [Mix] Support
--include-childreninmix deps.compileoption - [String] Update version of the Unicode database to 8.0.0
Bug fixes
- [Application] Ensure
spec/2returns nil for unknown applications - [Integer] Fix a possible binary leak in
parse/1 - [Mix] Purge Erlang modules on recompilation
- [String] Ensure
split/1does not break on non-breakable whitespace - [String] Ensure NFC and NFD normalization pass all of Unicode 8.0.0 tests
- [Version] Allow dots in build info for versions in
Version.parse/1
v1.2.3
Enhancements
- [Base] Add
:ignoreand:paddingoption to encoding/decoding functions - [Mix] Add
Mix.Projects.deps_pathsthat returns the dependencies path as a map
Bug fixes
- [ExUnit] Do not provide negative line numbers without generated annotation (for compatibility with Erlang 19)
- [Mix] Reject non fullfilled optional dependencies later on in the convergence resolution for proper dependency sorting
- [String] Fix incomplete data trimming on both
String.replace_trailingandString.rstrip - [String] Attach debug_info back into Unicode modules for Dialyzer support
v1.2.2
Enhancements
- [Kernel] Support
@compile {:autoload, false}to disable automatic loading after compilation
Bug fixes
- [ExUnit] Raise if trying to override reserved tag in
setupblocks - [Mix] Ensure retrieve compile manifests do fail if some compilers are not yet available
- [Mix] Automatically merge managers according to the mix > rebar3 > rebar > make order
- [Mix] Force recompilation if dependency was recently fetched
v1.2.1
Enhancements
- [IEx] Support remote pids/ports with IEx helper
i/1 - [Protocol] Warn when
defimplis called for a consolidated protocol
Bug fixes
- [ExUnit] Ensure
assertmacros can be used from quoted code - [ExUnit] Do not warn in match assertion if variable is reused in pattern
- [Macro] Fix a bug in
Macro.to_string/1where a remote function could be accidentally interpreted as a sigil - [Mix] Ensure dependencies are properly skipped when
--onlyoption is given tomix deps.get
v1.2.0
Official announcement: https://elixir-lang.org/blog/2016/01/03/elixir-v1-2-0-released/
1. Enhancements
Elixir
- [Application] Add
spec/1andspec/2to retrieve application specification - [Application] Add
get_application/1to retrieve the application a given module belongs to - [Base] Optimize encode and decode operations about 10 times
- [Enum] Use the faster and auto-seeding
:randinstead of:randominEnum.shuffle/1andEnum.random/1andEnum.take_random/2 - [Enum] Add
Enum.with_index/2 - [GenServer] Add
GenServer.stop/1for shutting down servers reliably - [IO] Add
colorrelated functions toIO.ANSI - [Kernel] Support multiple aliases in
alias,import,requireanduse. For example,alias MyApp.{Foo, Bar, Baz} - [Kernel] Add
struct!/2. Similar tostruct/2but raises on invalid keys - [Kernel] Warn if
@doc/@typedoc/@moduledocattributes are redefined - [Kernel] Warn if non-variables are used in
defdelegate/2(as they have no effect) - [Kernel] Mark quoted expressions as generated, avoiding false positives on dialyzer
- [Kernel] Allow variables as map keys on creation
%{key => value}and on matches%{^key => value} - [Kernel] Allow the pin operator
^infnclauses and on the left side of<-inforcomprehensions - [Kernel] Introduce
withas a special form that allows matching on right side parameters - [Kernel] Warn when right hand side of
->does not provide any expression - [Kernel] Warn if the Elixir was compiled with a different endianness than the one currently available at runtime
- [Kernel] Warn if a variable is used after being defined exclusively in a nested context
- [Kernel] Warn if piping into an expression without parentheses
- [Macro] Add
Macro.traverse/4that performs pre and post-walk at once - [Macro] Add
Macro.camelize/1andMacro.underscore/1 - [Process] Add
Process.get_keys/0 - [Stream] Add
Stream.with_index/2 - [String] Introduce
String.replace_{prefix,suffix,leading,trailing}/2. The first two will replace only the first occurrence of the given match in string. The last two will replace all occurrences of the given match - [String] Support
String.normalize/2andString.equivalent?/2that perform NFD and NFC normalization - [System] Add
System.time_offset,System.monotonic_time,System.system_time,System.convert_time_unitandSystem.unique_integer - [System] Allow
System.cmd/3to remove variables by specifying nil values - [Task] Add
Task.Supervisor.async_nolink/1/3that spawns a supervised task without linking to the caller process - [Task] Introduce
Task.yield_many/2 - [Task] Raise an error when a task is queried from a non-owning process (instead of waiting forever)
ExUnit
- [ExUnit] Allow one test to raise multiple errors. The goal is to enable tools in the ecosystem to emit multiple failure reports from the same test
- [ExUnit] Support
@tag report: [:foo, :bar]which will include the values for tags:fooand:barwhenever a test fails
IEx
- [IEx] Allow
IEX_WITH_WERLto be set on Windows to always run on WERL mode - [IEx] Display type docs for
t(Module.type)andt(Module.type/arity) - [IEx] Add
i/1helper that prints information about any data type - [IEx] Show source code snippet whenever there is a request to pry a given process
Logger
- [Logger] Add file to logger metadata
Mix
- [Mix] Cache and always consolidate protocols
- [Mix] Add
warn_test_patterntomix testthat will warn on potentially misconfigured test files - [Mix] Introduce
MIX_QUIETenvironment variable that configures the underlying Mix task to output only error messages - [Mix] Introduce
MIX_DEBUGenvironment variable that prints information about the task being run - [Mix] Validate git options and warn on conflicting ref, branch or tags
- [Mix] New umbrella applications will now share configuration and build files
- [Mix] Add experimental support for Rebar 3
- [Mix] Do not warn when an optional dependency has a conflicting
:onlyoption with another dependency - [Mix] Raise readable error message when parsertools is not available
- [Mix] Add
--buildflag tomix deps.clean DEPto only remove artifacts from_build
2. Bug fixes
Kernel
- [Access] Improve error messages when using Access on non-valid key-value structures
- [Kernel] Raise when conflicting
:onlyand:exceptare given to import - [Kernel] Change
__ENV__.fileif@fileis set for the given function - [Kernel] Make
Kernel.ParallelRequireaware of:warning_as_errors - [Kernel] Improve error message for invalid
do/do: - [Macro] Ensure
Macro.to_string/2respects operator precedence when using the access operator - [Path] Do not crash when expanding paths that go beyond the root, for example,
Path.expand("/../..") - [String] Ensure
UnicodeConversionErrordoes not contain invalid string in its error message
IEx
- [IEx] Do not start apps on
recompilehelper if--no-startwas given - [IEx] Avoid copying of data when evaluating every expression in IEx
Mix
- [Mix] Always run non-recursive tasks at the umbrella root
- [Mix] Ensure rebar projects work on directory names that contain non-latin characters
- [Mix] Ignore directories inside
appsin umbrellas that do not have amix.exsfile - [Mix] Ensure Mix can be used with path dependencies where the app name is different than the path basename
- [Mix] Ensure dependencies won't crash when updating from a git repository to a hex repository and the git version did not respect SemVer
- [Mix] Do not run remote converger if dependencies have diverged
- [Mix] Ensure umbrella dependencies across all environments are loaded on parent deps.get/deps.update
ExUnit
- [ExUnit] Include file and line in all compilation errors for doctests
3. Soft deprecations (no warnings emitted)
Kernel
- [Dict]
DictandHashDictare soft deprecated in favor ofMap - [Keyword]
Keyword.size/1is deprecated in favor oflength/1 - [Map]
Map.size/1is deprecated in favor ofmap_size/1 - [Set]
SetandHashSetare soft deprecated in favor ofMapSet
Mix
- [Mix]
Mix.Utils.camelize/1andMix.Utils.underscore/1are soft deprecated in favor ofMacro.camelize/1andMacro.underscore/1