zambal
Macro.escape/2 unquote option behaviour in Elixir 1.19
Hi, I noticed Absinthe tests failing when using Elixir 1.19.0-rc.2. After some investigation the issue seems to be a change in behaviour of Macro.escape/2 when using the :unquote option. For example, evaluating this expression:
iex> Macro.escape(%{field: {:unquote, [], [:test]}}, unquote: true)
Elixir 1.18: {:%{}, [], [field: :test]}
Elixir 1.19: {:%{}, [], [field: {:{}, [], [:unquote, [], [:test]]}]}
It seems that in 1.19 the unescaping only works when the parent node doesn’t need escaping. Macro.escape([{:unquote, [], [:test]}], unquote: true) for example results in [:test]
I noticed the added line in the documentation “Note this option will give a special meaning to quote/unquote nodes, which need to be valid AST before escaping.”, but to me it’s not entirely clear if this is the intended behaviour, as it is a breaking change, so I was wondering if anybody can confirm this is expected?
Most Liked
zambal
Yeah, I’m pretty sure this PR caused the change, but I didn’t have the time to properly look into it in order to be sure if this is intended, so that’s why I asked here.
sabiwara
Woops, good catch @zambal! ![]()
Created an issue, Macro.escape/2 doesn't honor :unquote option inside maps on 1.19rc · Issue #14829 · elixir-lang/elixir · GitHub.
Popular in Questions
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








