$ the-wire · showcase
Elixir fixes unary operator precedence with do-end blocks
By RepoJournal · Filed · About Elixir & Phoenix
Elixir's parser now resolves a precedence bug when unary operators meet do-end blocks, changing how some expressions compile.
José Valim fixed a precedence bug in the Elixir parser that mis-handled unary operations combined with do-end blocks [1]. The fix resolves two closed issues where code like `not if true do ... end` parsed incorrectly, so expressions of this shape now compile as intended instead of raising or behaving differently.
Two smaller Elixir corrections also landed [2][3]. The tuple difference implementation received corrected comments in its size and content branch logic, and the `__CALLER__.macro_aliases` type spec was fixed to match the actual runtime data. Neither changes runtime behavior, but both improve documentation and type-checking accuracy.
Action items
- → Monitor parser change: re-test any complex unary expressions with do-end blocks in your codebase elixir-lang/elixir [monitor]
References
- [1] Fix precedence when parsing unary ops with do-end blocks ↗ elixir-lang/elixir
- [2] Correct tuple difference comments (#15859) ↗ elixir-lang/elixir
- [3] Fix __CALLER__.macro_aliases type (#15853) ↗ elixir-lang/elixir