Elixir
Elixir v1.20.0-rc.5 released
This release requires Erlang/OTP 27+ and is compatible with Erlang/OTP 29.
1. Enhancements
EEx
- [EEx] Optimize compiler by flattening expr list only once
Elixir
- [Base] Optimize Base validation functions by using SWAR techniques
- [Float] Optimize
Float.round/2by avoiding big integers - [Inspect] Increase inspect limit to help print deeply nested data structures
- [Inspect] Support printing Erlang records (using Erlang notation)
- [Kernel] Add occurrence typing on
case,cond, andwith - [Registry] Switch
{:duplicate, :key}key_ets to ordered_set with composite keys - [String] SWAR-optimize ASCII fast paths in
String.length/1andString.slice/3
ExUnit
- [ExUnit] Show remaining runs when using
--repeat-until-failure
IEx
- [IEx.Helpers] Add
source/1
Mix
- [mix app.tree] Support
--outputoption - [mix deps.tree] Support
--outputoption - [mix help] Support printing docs for types and callbacks
- [mix format] Support
--no-compileoption - [mix source] Add
mix source MODULEto print or open a given module/function location
2. Potential breaking changes
Elixir
- [Kernel] Disallow raw CR line ending in strings, comments and after
?for security reasons
3. Bug fixes
Elixir
- [Kernel] Fix a compiler crash when importing a module with
only: :sigilsoption when the imported module exports non-sigil symbols withsigil_prefix - [Kernel] Reject negative Duration in
to_timeout/1 - [Macro] Fix generation of heredocs in
Macro.to_string/1with escaped trailing newline - [Path] Consistently return path as binary in
Path.relative_to_cwd/2 - [Stream] Raise in
Stream.cycle/1when enumerable reduce call yields no elements - [String] Support empty pattern list in
String.count/2
Logger
- [Logger] Persist log level to app env in
Logger.configure/1
Mix
- [Mix] Use
non_executable_binary_to_termon loopback pubsub - [mix compile.elixir] Fix scenario where Elixir would tag mtimes in the future
Most Liked
josevalim
As usual, this release has additional type checks and performance improvements. Please give it a try. We expect only one additional RC after this one with any pending fixes, so we can release v1.20.0.
vkryukov
Congratulations on the release! Are you interested in false positive type warnings - should we report them as bugs? E.g., I have a piece of HEEX where the type checker complains but stop complaining if I simply change the order
<.yinsh_score_ring
:for={index <- 1..3}
# no complaints if `earned?` is placed here instead
# earned?={index <= player.yinsh_rings_removed}
id={"#{@id}-#{player.color}-ring-score-#{index}"}
color={player.color}
earned?={index <= player.yinsh_rings_removed}
/>
The type warning:
type warning found at:
│
270 │ earned?={index <= player.yinsh_rings_removed}
│ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│
└─ lib/playgipf_web/components/game_components.ex:270: PlaygipfWeb.GameComponents."game_topbar (overridable 1)"/1
warning: comparison with structs found:
index <= player.yinsh_rings_removed
given types:
dynamic(
%{
...,
__struct__:
Date or DateTime or Decimal or NaiveDateTime or Phoenix.LiveComponent.CID or Postgrex.Copy or
Postgrex.Query or Postgrex.TextQuery or Time or URI or Version or Version.Requirement
} or atom() or bitstring() or empty_list() or float() or integer() or
non_empty_list(term(), term())
) <= dynamic()
where "index" was given the type:
# type: dynamic(
%{
...,
__struct__:
Date or DateTime or Decimal or NaiveDateTime or Phoenix.LiveComponent.CID or Postgrex.Copy or
Postgrex.Query or Postgrex.TextQuery or Time or URI or Version or Version.Requirement
} or atom() or bitstring() or empty_list() or float() or integer() or
non_empty_list(term(), term())
)
# from: lib/playgipf_web/components/position_components/position_panel.ex:441
to_string(index)
where "player" was given the types:
# type: dynamic(%{..., game_type: term()})
# from: lib/playgipf_web/components/position_components/position_panel.ex:431
player.game_type == :yinsh
# type: dynamic(%{..., game_type: :yinsh})
# from: lib/playgipf_web/components/position_components/position_panel.ex:431
player.game_type == :yinsh
# type: dynamic(%{..., game_type: :yinsh, yinsh_setup?: false})
# from: lib/playgipf_web/components/position_components/position_panel.ex:431
not player.yinsh_setup?
# type: dynamic(%{
...,
color:
%{
...,
__struct__:
Date or DateTime or Decimal or NaiveDateTime or Phoenix.LiveComponent.CID or Postgrex.Copy or
Postgrex.Query or Postgrex.TextQuery or Time or URI or Version or Version.Requirement
} or atom() or bitstring() or empty_list() or float() or integer() or
non_empty_list(term(), term()),
game_type: :yinsh,
yinsh_setup?: false
})
# from: lib/playgipf_web/components/position_components/position_panel.ex:441
to_string(player.color)
Comparison operators (>, <, >=, <=, min, and max) perform structural and not semantic comparison. Comparing with a struct won't give meaningful results. Structs that can be compared typically define a compare/2 function within their modules that can be used for semantic comparison.
josevalim
Last Post!
sodapopcan
Oh for sure, I’ve just always found it odd is all I’m saying. Like it would be nice to know that and and or always return a boolean. My comments around the warning are akin to 1 > :foo being totally legal and documented but now being flagged as a warning (which is nice). Although there are probably good scenarios where you would want bool on the left and get get the return value of the right, I just can’t think of any of the top of my head.
Also, confusion is also because I missed this post of yours due to the way the Discourse notifications work and you replied directly too me after that one.
Popular in News
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









