Skip to content

Releases: elixir-lang/elixir

v1.11.4

16 Mar 12:49
Compare
Choose a tag to compare

This release introduces fixes for better support of Erlang/OTP 24+.

1. Enhancements

Elixir

  • [Kernel] Update formatting when printing warnings and errors from Erlang/OTP 24+
  • [Kernel] Support float-16 on bitstrings

Mix

  • [mix local.rebar] This task will now install rebar3 version 3.14.4, compiled with Erlang/OTP 21

Checksums

  • Precompiled.zip SHA1: 2b421e7f4b8d62af5c9238f5cf127938d3523f23
  • Precompiled.zip SHA512: 4d8ead533a7bd35b41669be0d4548b612d5cc17723da67cfdf996ab36522fd0163215915a970675c6ebcba4dbfc7a46e644cb144b16087bc9417b385955a1e79
  • Docs.zip SHA1: 756f7327dc515399dfd93e3f0858cd5295d49f0e
  • Docs.zip SHA512: 93b457592efc19f3305e87156211c938c8648294e8d21fd895c0d12013530fc7f066fb636d08edb784ee8bf4bef6d1cf9cef7a7ed4d18f76cc4087aaa27176ef

v1.11.3

04 Jan 15:57
Compare
Choose a tag to compare

1. Enhancements

Elixir

  • [Macro] Add Macro.unique_var/2 and Macro.generate_unique_arguments/2

2. Bug fixes

Elixir

  • [Code] Do not raise when checking for operator ambiguity when :static_atoms_encoder is set in Code.string_to_quoted
  • [Kernel] Emit undefined function warnings from with
  • [Kernel] Do not fail type checking when literals are used in guards
  • [Module] Do not warn for attributes used in @after_compile
  • [Record] Make sure nested record names do not clobber each other

ExUnit

  • [ExUnit.Assertions] Do not crash if there are macros and module attributes on the left side of ++

IEx

  • [IEx.Helpers] Do not use Unicode chars if ANSI is disabled

Mix

  • [mix deps.compile] Fix compatibility with rebar v3.14
  • [mix release] Do not use private ram_file:compress/1
  • [mix xref] Do not crash when retrieving calls for modules in memory

Checksums

  • Precompiled.zip SHA1: 430735e03d8dfcba3324010d397ab7871b30d87d
  • Precompiled.zip SHA512: 16cdd30e41737ba9d659e506b4aa79465ede2d93d27a720d6a3649b8100da9f7dee154a913438724651a83aea77ddef33ac1489bb7ae283b39fbfe20dcd77db4
  • Docs.zip SHA1: 57c7e45ca2a3bf6d56c628e46c5e02c96730b35c
  • Docs.zip SHA512: 9bd41d2b26d716fe931a7d16d0f79df1d5dd16384dc8e448dfc07d98409516382072f64bcf443e5ed18e0b36b8e08fc552d78ede611087a49c2dc2e83f196194

v1.11.2

03 Nov 14:31
Compare
Choose a tag to compare

1. Bug fixes

Elixir

  • [Code] Do not crash when getting docs for missing erts appdir
  • [Kernel] Raise meaningful error if :erlang.is_record is used in guards
  • [Kernel] Prune tracers when fetching __ENV__ inside functions

Mix

  • [mix] Fix regression where aliases could not call themselves recursively
  • [mix compile] Do not discard tracers that are set programmatically

Checksums

  • Precompiled.zip SHA1: 1c54c01b5449d631e673e4aaf205522eaeb8dbdc
  • Precompiled.zip SHA512: 7b6ece70d2db6cf4b02c3e72f0ae2edc68e13a2651876525eab08e3c3c3f1f88d294e3f412c3fb736bc84ba4c2897930101b0ac715e322f1554f29c69e2d1e77
  • Docs.zip SHA1: 6af70fd002e7a636e993f90443f99e2de333a2cd
  • Docs.zip SHA512: 78d5ad489e3788c4c4257de404ee0e09c4f0cf5ba45290e331ddbe1f980796acda54559fba0a1fd55c4ea34d469129b1c4f1d9aac029807fff8e865919b2613a

v1.11.1

16 Oct 08:08
Compare
Choose a tag to compare

1. Bug fixes

Elixir

  • [Code] Ignore tracers if lexical tracker is dead or explicitly nil when evaling code with an environment
  • [GenServer] Do not show warning when using super in GenServer.child_spec/1
  • [Kernel] Do not crash when :reduce is set to nil in comprehensions
  • [Kernel] Fix a scenario where undefined function warnings were not being emitted

IEx

  • [IEx.Helpers] Properly handle tags inside typespec when showing Erlang docs

Logger

  • [Logger] Do not deadlock Logger if handler crashes on sync mode

Mix

  • [Mix] Add inet6 fallback to Mix usage of httpc
  • [mix compile.app] Do not list apps that do not match the current target

Checksums

  • Precompiled.zip SHA1: f03301dd10072f3643a4c1e5f012a49bfc493608
  • Precompiled.zip SHA512: c70e7d3e338ab2449301c7864a2dd96e8d474f3fee533a66706c67cd733db74c2d529b9887961db9f07530eeed4cce917c480e5e8c4201060c7fa494e8b376da
  • Docs.zip SHA1: b4045584e5dddc01202bcbd0f4ff0623b3a37958
  • Docs.zip SHA512: 9e8d5467b37588c3a885b4745e014fffe91a72194fc076ccaf4abee4bd08c48792d0d89fd3fa16f0d3d10739e0c6d2213e07bfa51bd50ebcad6d74fbad79277b

v1.11.0

06 Oct 14:29
Compare
Choose a tag to compare

Over the last releases, the Elixir team has been focusing on the compiler, both in terms of catching more mistakes at compilation time and making it faster. Elixir v1.11 has made excellent progress on both fronts. This release also includes many other goodies, such as tighter Erlang integration, support for more guard expressions, built-in datetime formatting, and other calendar enhancements.

Tighter Erlang integration

Following Elixir v1.10, we have further integrated with Erlang's new logger by adding four new log levels: notice, critical, alert, and emergency, matching all log levels found in the Syslog standard. The Logger module now supports structured logging by passing maps and keyword lists to its various functions. It is also possible to specify the log level per module, via the Logger.put_module_level/2 function. Log levels per application will be added in future releases.

IEx also has been improved to show the documentation for Erlang modules directly from your Elixir terminal. This works with Erlang/OTP 23+ and requires Erlang modules to have been compiled with documentation chunks.

Compiler checks: application boundaries

Elixir v1.11 builds on top of the recently added compilation tracers to track application boundaries. From this release, Elixir will warn if you invoke a function from an existing module but this module does not belong to any of your listed dependencies.

These two conditions may seem contradictory. After all, if a module is available, it must have come from a dependency. This is not true in two scenarios:

  • Modules from Elixir and Erlang/OTP are always available - even if their applications are not explicitly listed as a dependency

  • In an umbrella project, because all child applications are compiled within the same VM, you may have a module from a sibling project available, even if you don't depend on said sibling

This new compiler check makes sure that all modules that you invoke are listed as part of your dependencies, emitting a warning like below otherwise:

:ssl.connect/2 defined in application :ssl is used by the current
application but the current application does not directly depend
on :ssl. To fix this, you must do one of:

  1. If :ssl is part of Erlang/Elixir, you must include it under
     :extra_applications inside "def application" in your mix.exs

  2. If :ssl is a dependency, make sure it is listed under "def deps"
     in your mix.exs

  3. In case you don't want to add a requirement to :ssl, you may
     optionally skip this warning by adding [xref: [exclude: :ssl]
     to your "def project" in mix.exs

This comes with extra benefits in umbrella projects, as it requires child applications to explicitly list their dependencies, completely rejecting cyclic dependencies between siblings.

Compiler checks: data constructors

In Elixir v1.11, the compiler also tracks structs and maps fields across a function body. For example, imagine you wanted to write this code:

def drive?(%User{age: age}), do: age >= 18

If there is either a typo on the :age field or the :age field was not yet defined, the compiler will fail accordingly. However, if you wrote this code:

def drive?(%User{} = user), do: user.age >= 18

The compiler would not catch the missing field and an error would only be raised at runtime. With v1.11, Elixir will track the usage of all maps and struct fields within the same function, emitting warnings for cases like above:

warning: undefined field `age` in expression:

    # example.exs:7
    user.age

expected one of the following fields: name, address

where "user" was given the type %User{} in:

    # example.exs:7
    %User{} = user

Conflict found at
  example.exs:7: Check.drive?/1

The compiler also checks binary constructors. Consider you have to send a string over the wire with length-based encoding, where the string is prefixed by its length, up to 4MBs. Your initial attempt may be this:

def run_length(string) when is_binary(string) do
  <<byte_size(string)::32, string>>
end

However, the code above has a bug. Each segment given between <<>> must be an integer, unless specified otherwise. With Elixir v1.11, the compiler will let you know so:

warning: incompatible types:

    binary() !~ integer()

in expression:

    <<byte_size(string)::integer()-size(32), string>>

where "string" was given the type integer() in:

    # foo.exs:4
    <<byte_size(string)::integer()-size(32), string>>

where "string" was given the type binary() in:

    # foo.exs:3
    is_binary(string)

HINT: all expressions given to binaries are assumed to be of type integer()
unless said otherwise. For example, <<expr>> assumes "expr" is an integer.
Pass a modifier, such as <<expr::float>> or <<expr::binary>>, to change the
default behaviour.

Conflict found at
  foo.exs:4: Check.run_length/1

Which can be fixed by adding ::binary to the second component:

def run_length(string) when is_binary(string) do
  <<byte_size(string)::32, string::binary>>
end

While some of those warnings could be automatically fixed by the compiler, future versions will also perform those checks across functions and potentially across modules, where automatic fixes wouldn't be desired (nor possible).

Compilation time improvements

Elixir v1.11 features many improvements to how the compiler tracks file dependencies, such that touching one file causes less files to be recompiled. In previous versions, Elixir tracked three types of dependencies:

  • compile time dependencies - if A depends on B at compile time, such as by using a macro, whenever B changes, A is recompiled
  • struct dependencies - if A depends on B's struct, whenever B's struct definition changed, A is recompiled
  • runtime dependencies - if A depends on B at runtime, A is never recompiled

However, because dependencies are transitive, if A depends on B at compile time and B depends on C at runtime, A would depend on C at compile time. Therefore, it is very important to reduce the amount of compile time dependencies.

Elixir v1.11 replaces "struct dependencies" by "exports dependencies". In other words, if A depends on B, whenever B public's interface changes, A is recompiled. B's public interface is made by its struct definition and all of its public functions and macros.

This change allows us to mark imports and requires as "exports dependencies" instead of "compile time" dependencies. This simplifies the dependency graph considerably. For example, in the Hex.pm project, changing the user.ex file in Elixir v1.10 would emit this:

$ touch lib/hexpm/accounts/user.ex && mix compile
Compiling 90 files (.ex)

In Elixir v1.11, we now get:

$ touch lib/hexpm/accounts/user.ex && mix compile
Compiling 16 files (.ex)

To make things even better, Elixir v1.11 also introduces a more granular file tracking for path dependencies. In previous versions, a module from a path dependency would always be treated as a compile time dependency. This often meant that if you have an umbrella project, changing an application would cause many modules in sibling applications to recompile. Fortunately, Elixir v1.11 will tag modules from dependencies as exports if appropriate, yielding dramatic improvements to those using path dependencies.

To round up the list of compiler enhancements, the --profile=time option added in Elixir v1.10 now also includes the time to compile each individual file. For example, in the Plug project, one can now get:

[profile] lib/plug/conn.ex compiled in 935ms
[profile] lib/plug/ssl.ex compiled in 147ms (plus 744ms waiting)
[profile] lib/plug/static.ex compiled in 238ms (plus 654ms waiting)
[profile] lib/plug/csrf_protection.ex compiled in 237ms (plus 790ms waiting)
[profile] lib/plug/debugger.ex compiled in 719ms (plus 947ms waiting)
[profile] Finished compilation cycle of 60 modules in 1802ms
[profile] Finished group pass check of 60 modules in 75ms

While implementing those features, we have also made the --long-compilation-threshold flag more precise. In previous versions, --long-compilation-threshold would consider both the time a file spent to compile and the time spent waiting on other files. In Elixir v1.11, it considers only the compilation time. This means less false positives and you can now effectively get all files that take longer than 2s to compile by passing --long-compilation-threshold 2.

mix xref graph improvements

To bring visibility to the compiler tracking improvements described in the previous section, we have also added new features to mix xref. mix xref is a task that describes cross-references between files in your projects. The mix xref graph subsection focuses on the dependency graph between them.

First we have made the existing --label flag to consider transitive dependencies. Using --sink FILE and --label compile can be a powerful combo to find out which files will change whenever the given FILE changes. For example, in the Hex.pm project, we get:

$ mix xref graph --sink lib/hexpm/accounts/user.ex --label compile
lib/hexpm/billing/hexpm.ex
└── lib/hexpm/billing/billing.ex (compile)
lib/hexpm/billing/local.ex
└── lib/hexpm/billing/billing.ex (compile)
lib/hexpm/emails/bamboo.ex
├── lib/hexpm/accounts/email.ex (compile)
└── lib/hexpm/accounts/user.ex (compile)
lib/hexpm/emails/emails.ex
└── lib/hexpm_web/views/email_view.ex (compile)
lib/hexpm_web/controllers/api/docs_controller.ex
└── lib/hexpm_web/controllers/auth_helpers.ex (compile)
lib/hexpm_web/controllers/api/key_controller.ex
└── lib/hexpm_web/controllers/auth_helpers.ex (compile)
lib/hexpm_web/controllers/api/organization_controller.ex
└── lib/hexpm...
Read more

v1.11.0-rc.0

14 Sep 07:25
Compare
Choose a tag to compare
v1.11.0-rc.0 Pre-release
Pre-release

Checksums

  • Precompiled.zip SHA1: 5d70b6254d7a89930e09c85718d99deddd186092
  • Precompiled.zip SHA512: bc2bb21b5dd8fadc8bbd9b53ba676e31af3b13fcaca776ee0b461acef55964ee453fb7e1e95cc3c4bbfd12d6cd68c02034cc104597e18047a574d484eb64cd52
  • Docs.zip SHA1: df47a509caafa9b99c1d4bdf5fae6bdccce3f32b
  • Docs.zip SHA512: 0372f7a8ed98044c7cce4d5b690373abec81818c3e6790543653675f2359131d6ba485921e8f30cafc660f8849525383a175e1c4eeb7707c47986792e7616e4f

v1.10.4

04 Jul 11:21
Compare
Choose a tag to compare

1. Bug fixes

Elixir

  • [Kernel] Fix a bug where custom types were printed as built-in types
  • [Kernel] Don't add compile-time dependency on defdelegate
  • [Kernel] Add line numbers to warnings on deprecated imports
  • [Kernel] Report the correct line number when raising inside a macro
  • [Task] Include callers in translated Logger metadata for Task
  • [Task] Fix Task PID and caller in Task Supervisor reports

ExUnit

  • [ExUnit.Formatter] Avoid crashes when diffing guards when the pattern does not match
  • [ExUnit.Formatter] Also blame exceptions that come from linked and trapped exits

IEx

  • [IEx.Helpers] Do not crash when printing a type that cannot be code formatted

Mix

  • [mix app.start] Fix reading .app file located in archives (.ez files)
  • [mix local.hex] Provide more guidance when Hex can't be installed
  • [mix release] Properly encode config in releases

Checksums

  • Precompiled.zip SHA1: 5b400c829c4f239ac89a7eb97aac642b961f38fd
  • Precompiled.zip SHA512: 9727ae96d187d8b64e471ff0bb5694fcd1009cdcfd8b91a6b78b7542bb71fca59869d8440bb66a2523a6fec025f1d23394e7578674b942274c52b44e19ba2d43
  • Docs.zip SHA1: 178f08724c63496878b6e427467f650f03cd978c
  • Docs.zip SHA512: cefaf0371a9751d37d6d1181f910a23d6cc627f7b77fe7fa1b303a9b4769d1fb2a9bbeea54566109fa5acf8e0455a5a44cb3ac9ccb9e968d92610b869d15d27c

v1.10.3

25 Apr 08:37
Compare
Choose a tag to compare

1. Bug fixes

Elixir

  • [Code] Return [{mod, bin}] from Code.compile_file/2, Code.require_file/2, Code.load_file/2
  • [Code] Make sure the formatter respects newlines before and after module attributes
  • [Kernel.ParallelCompiler] Fix a bug where the parallel compiler would raise in long compilation cycles
  • [Kernel.ParallelCompiler] Fix a bug where the parallel compiler would raise if some of the modules being compiled referred to a module that has been loaded directly to memory
  • [Module] Fix accidental breaking change where bodiless clauses had their body value on @on_definition callbacks set to an empty list instead of nil
  • [String] Undeprecate String.normalize/2 normalize and fix infinite loop caused by certain invalid strings

ExUnit

  • [ExUnit.Assertions] Fix pattern matching diff when matching on pinned variables
  • [ExUnit.Assertions] Fix pattern matching diff when matching variable struct names
  • [ExUnit.Assertions] Fix pattern matching diff when matching on the binary concat operator (<>) and the left side is not a literal string
  • [ExUnit.Assertions] Fix pattern matching diff when matching on pseudo-vars (__MODULE__, __DIR__, etc)

Mix

  • [mix release] Respect the :path option when creating a :tar file for releases

Checksums

  • Precompiled.zip SHA1: 382fa22e6f184c0cc87fcfbfa0053c349d85f6f1
  • Precompiled.zip SHA512: fc6d06ad4cc596b2b6e4f01712f718200c69f3b9c49c7d3b787f9a67b36482658490cf01109b0b0842fc9d88a27f64a9aba817231498d99fa01fa99688263d55
  • Docs.zip SHA1: e417c3849bbc0371e805b3265dbbb21e3ef02d3f
  • Docs.zip SHA512: 6ffb0376701570fc06ecc801c8151deec700b8636278834c0e3b06798418193da916e99de9644239347d5239915b2161e17d6a155723551d82eb212592adb9bf

v1.10.2

26 Feb 12:02
Compare
Choose a tag to compare

1. Bug fixes

Elixir

  • [Macro] Fix a bug where Macro.to_string/1 would emit invalid code for sigils
  • [Task] Do not crash async_stream monitor if it receives spurious DOWN messages

Logger

  • [Logger] Fix a bug where the Logger formatter would fail when handling unknown metadata values

Mix

  • [mix compile] Do not write files to disk if --warnings-as-errors was given and warnings were emitted

Checksums

  • Precompiled.zip SHA1: 830264881231e711d8bade711ed2819a2d10b918
  • Precompiled.zip SHA512: 532f43f08a29b5cbfca5a544c337b4a6d336d372ba0a5b3393681426d57ecaa85960e8eb3548aea26f213cc36914c6b66b83707cd719e27dc34c40efadb9f0b9
  • Docs.zip SHA1: cca85f8f2dec9adbc52022d4666dd01bd0793424
  • Docs.zip SHA512: c485dd315113cc13509bf47b4992f9e1825d433f5f5c923f22c792b100afa09e42ee7975c93c8d585bf58fce1713b50864c1fde829feda3c361335357b9b10ae

v1.10.1

10 Feb 11:53
Compare
Choose a tag to compare

1. Bug fixes

Elixir

  • [Code] Do not emit invalid code when formatting nil, false, and true keys in maps
  • [Kernel] Ensure with clauses properly unpack "implicit guards" (such as matching on the struct name)
  • [Kernel] Do not warn if commas are used by themselves in ~w/~W sigils
  • [Kernel] Do not validate the :line option in quote (the validation has been moved to v1.11 to give users more time to update their code)
  • [Module] Ensure the code verifier handles the :erlang.size/1 guard properly

Logger

  • [Logger] Properly handle the report_cb/2 option from Erlang
  • [Logger] Fix truncation for multi-byte characters
  • [Logger] Do not rebroadcast messages from remote nodes as this is now taken care by Erlang's logger

ExUnit

  • [ExUnit] Ensure assert_receive produces valid exception messages in case of errors

Mix

  • [mix release] Make sure the install command (Window specific) works on paths with spaces in the name
  • [mix release] Allow using remote and rpc commands with Application.compile_env/3

Checksums

  • Precompiled.zip SHA1: 606ffaff6c7c3d278d7daa1fee653aa8183f225f
  • Precompiled.zip SHA512: e8809aff909ca6e2271493690a6a095959e551f6d04e2d384ead0d6cfde23a3707492b53563b9a78080509b44728a63645dc37be108cd6ea3f9501f5d616fe1d
  • Docs.zip SHA1: bb050e0b56a2d32562f7c876f8eed53846b857fe
  • Docs.zip SHA512: be8ffec17cd15a439f78857eee615793d4d22a9b38b34df94d8546bb0f0b5745974115337cadcefebc82feef62d6f2d5a19f50f563f4efc9c9e4543815ccf85b