Fixes for quote interpolation in Expr compat mode #57
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.
Ensure that interpolating values into quoted expressions works in Expr compat mode.
ExprinCodeInfoconversion, add anas_Exprmeta attribute toK"inert"generated byexpand_quote. I left this as a meta attribute because it doesn't need to be strongly typed.eval(), addexpr_compat_modekeyword toinclude_string. We may want to rethink this when we rethink how options toeval()work.interpolate_astto work with bothExprandSyntaxTreeas the source expression.Symbolto be interpolated intoSyntaxTreeas syntax rather than aK"Value": Even in "new style macro mode",:xis interpreted as aSymbol` rather than an AST as it's used by many packages as a kind of lightweight untyped enum (ie, a usage which is almost entirely unrelated to AST manipulation)SyntaxTree->Exprconversion so that embedded ExprK"Value"means a leaf, not an embedded tree.Follows up on #44, in particular, resolves the comment at #44 (comment)_
In terms of the implementation, I tried the alternative of keeping
SyntaxTreein theCodeInforather thanExprand using that as the reference expression ininterpolate_ast- I had hoped this might be cleaner and less effort. However, this approach ends up needing a "partial" non-recursive implementation ofExpr->SyntaxTreeconversion (in particular, one where child nodes have already been converted) and that would have required more changes on theJuliaSyntaxside than I wanted. However, we might need that kind of non-recursive machinery in the future. For example, for customizing SyntaxTree->Expr conversion - if we do, we can reconsider the implementation ofinterpolate_astat that point.