Update dependency elixir to v1.17.0 #68
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.16.3
->1.17.0
Release Notes
elixir-lang/elixir (elixir)
v1.17.0
Compare Source
https://elixir-lang.org/blog/2024/06/12/elixir-v1-17-0-released/
This release includes type inference of patterns to provide warnings for an initial set of constructs (binaries, maps, and atoms) within the same function. It also includes a new Duration data type to interact with Calendar types, support for Erlang/OTP 27, and many other improvements.
Warnings from gradual set-theoretic types
This release introduces gradual set-theoretic types to infer types from patterns and use them to type check programs, enabling the Elixir compiler to find faults and bugs in codebases without requiring changes to existing software. The underlying principles, theory, and roadmap of our work have been outlined in "The Design Principles of the Elixir Type System" by Giuseppe Castagna, Guillaume Duboc, José Valim.
At the moment, Elixir developers will interact with set-theoretic types only through warnings found by the type system. The current implementation models all data types in the language:
binary()
,integer()
,float()
,pid()
,port()
,reference()
- these types are indivisible. This means both1
and13
get the sameinteger()
type.atom()
- it represents all atoms and it is divisible. For instance, the atom:foo
and:hello_world
are also valid (distinct) types.map()
and structs - maps can be "closed" or "open". Closed maps only allow the specified keys, such as%{key: atom(), value: integer()}
. Open maps support any other keys in addition to the ones listed and their definition starts with...
, such as%{..., key: atom(), value: integer()}
. Structs are closed maps with the__struct__
key.tuple()
,list()
, andfunction()
- currently they are modelled as indivisible types. The next Elixir versions will also introduce fine-grained support to them.We focused on atoms and maps on this initial release as they are respectively the simplest and the most complex types representations, so we can stress the performance of the type system and quality of error messages. Modelling these types will also provide the most immediate benefits to Elixir developers. Assuming there is a variable named
user
, holding a%User{}
struct with anaddress
field, Elixir v1.17 will emit the following warnings at compile-time:Pattern matching against a map or a struct that does not have the given key, such as
%{adress: ...} = user
(noticeaddress
vsadress
)Accessing a key on a map or a struct that does not have the given key, such as
user.adress
Updating a struct or a map that does not define the given key, such as
%{user | adress: ...}
Invoking a function on non-modules, such as
user.address()
Capturing a function on non-modules, such as
&user.address/0
Attempting to invoke to call an anonymous function without an actual function, such as
user.()
Performing structural comparisons with structs, such as
my_date < ~D[2010-04-17]
Performing structural comparisons between non-overlapping types, such as
integer >= string
Building and pattern matching on binaries without the relevant specifiers, such as
<<name>>
(this warns because by default it expects an integer, it should have been<<name::binary>>
instead)Attempting to rescue an undefined exception or a struct that is not an exception
Accessing a field that is not defined in a rescued exception
These new warnings help Elixir developers find bugs earlier and give more confidence when refactoring code, especially around maps and structs. While some of these warnings were emitted in the past, they were discovered using syntax analysis. The new warnings are more reliable, precise, and with better error messages. Keep in mind, however, that the Elixir typechecker only infers types from patterns within the same function at the moment. Analysis from guards and across function boundaries will be added in future relases. For more details, see our new reference document on gradual set-theoretic types.
The type system was made possible thanks to a partnership between CNRS and Remote. The development work is currently sponsored by Fresha, Starfish*, and Dashbit.
Erlang/OTP support
This release adds support for Erlang/OTP 27 and drops support for Erlang/OTP 24. We recommend Elixir developers to migrate to Erlang/OTP 26 or later, especially on Windows. Support for WERL (a graphical user interface for the Erlang terminal on Windows) will be removed in Elixir v1.18.
Adding
Duration
andshift/2
functionsElixir introduces the
Duration
data type and APIs to shift dates, times, and date times by a given duration, considering different calendars and time zones.Note the operation is called
shift
(instead ofadd
) since working with durations does not obey properties such as associativity. For instance, adding one month and then one month does not give the same result as adding two months:Still, durations are essential for building intervals, recurring events, and modelling scheduling complexities found in the world around us. For
DateTime
s, Elixir will correctly deal with time zone changes (such as Daylight Saving Time), but provisions are also available in case you want to surface conflicts (for example, you shifted to a wall clock that does not exist, because the clock has been moved forward by one hour). SeeDateTime.shift/2
for examples.Finally, a new
Kernel.to_timeout/1
function has been added, which helps developers normalize durations and integers to a timeout used by Process APIs. For example, to send a message after one hour, one can now write:v1.17.0 (2024-06-12)
1. Enhancements
Elixir
Access.find/1
that mirrorsEnum.find/2
Code.Fragment.container_cursor_to_quoted/2
Date.shift/2
to shift dates with duration and calendar-specific semanticsDate
to accept years outside of-9999..9999
rangeDateTime.shift/2
to shift datetimes with duration and calendar-specific semanticsDuration
data typec:GenServer.format_status/1
callbackKernel.get_in/1
with safe nil-handling for access and structsKernel.is_non_struct_map/1
guardKernel.to_timeout/1
Keyword.intersect/2-3
to mirror theMap
APIMacro.Env.define_alias/4
,Macro.Env.define_import/4
,Macro.Env.define_require/4
,Macro.Env.expand_alias/4
,Macro.Env.expand_import/5
, andMacro.Env.expand_require/6
to aid the implementation of language servers and embedded languagesNaiveDateTime.shift/2
to shift naive datetimes with duration and calendar-specific semanticsProcess.set_label/1
String.byte_slice/3
to slice a string to a maximum number of bytes while keeping it UTF-8 encodeduse_stdio: false
inSystem.cmd/3
andSystem.shell/2
Time.shift/2
to shift times with duration and calendar-specific semanticsExUnit
start_supervised
IEx
recompile
was called and the current working directory changedc/0
as an alias tocontinue/0
IEx.Pry.annotate_quoted/3
to annotate a quoted expression with pry breakpointsLogger
:gen_statem
reports using Elixir data structuresMix
:depth
option toMix.SCM.Git
, thus supporting shallow clones of Git dependencies:optional
is used in combination with:in_umbrella
--umbrella-only
tomix deps.tree
mix test --breakpoints
that sets up a breakpoint before each test that will runmix test --repeat-until-failure
to rerun tests until a failure occursmix test --slowest-modules
to print slowest modules based on all of the tests they hold2. Bug fixes
Elixir
(a -> b)
were not wrapped as part of the literal encoder..
and...
are handled at the AST levelquote bind_quoted: ...
twice:line
property when:file
is given as option toquote
Macro.escape/2
when passing a quote triplet without valid metaModule.get_attribute/3
for persisted attributes which have not yet been written toIEx
Mix
3. Soft deprecations (no warnings emitted)
Elixir
c:GenServer.format_status/2
callback to align with Erlang/OTP 25+Mix
mix profile.tprof
mix profile.tprof
4. Hard deprecations
Elixir
:all
toIO.read/2
andIO.binread/2
is deprecated, pass:eof
instead~c
insteadleft..right
without explicit steps inside patterns and guards is deprecated, writeleft..right//step
instead10..1
without an explicit step is deprecated, write10..1//-1
insteadExUnit
register_test/4
is deprecated in favor ofregister_test/6
for performance reasonsConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.