Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly Macro.escape :quote triplet without meta #13594

Merged
merged 6 commits into from
May 24, 2024

Conversation

kristofka
Copy link
Contributor

Attempts to solve #13593
Attempts to solve an issue that causes Macro.escape/2 to crash when
given certain tuples.

Note that, as discussed in the reported issue, Macro.escape({:quote, [column: 10], [:foo]}) still produces
: {:{}, [], [:quote, [], [:foo]]} which is arguably wrong.

Attempts to solve an issue that causes `Macro.escape/2` to crash when
given certain tuples.

Note that, `Macro.escape({:quote, [column: 10], [:foo]})` still produces
: `{:{}, [], [:quote, [], [:foo]]}` which is arguably wrong.
@josevalim
Copy link
Member

I think we should have the is_list check a bit higher. We should not even be attempting to keydelete it. We should possibly be adding is_list(Meta) to all clauses here in do_quote:

do_quote({quote, Meta, [Arg]}, Q) ->

Moves the `is_list` test closer to the issue.
@kristofka
Copy link
Contributor Author

You are correct, this makes the intent cleaner. Unfortunately, I'm still unsure how to avoid passing something of the form {:quote, [column: :bar], [:foo]} . So far my attempts to restrict the match at the level of the first clause have failed.

@josevalim josevalim changed the title Fix for #13593 Correctly Macro.escape :quote triplet without meta May 24, 2024
@josevalim josevalim merged commit 4e478b3 into elixir-lang:main May 24, 2024
9 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants