You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems as though the macro is assumed to expand to a statement if it is placed where a statement is allowed, causing an error even though it actually expands to an expression.
The Macros Tutorial says that macros are parsed as (paraphrased) "appropriate placeholders". Shouldn't this placeholder permit being treated as an expression even in a context where it isn't yet known whether it is an expression or not?
The text was updated successfully, but these errors were encountered:
Thanks for the report; this is a dup of #5941, and is caused by exactly what you say: if a macro is syntactically allowed to expand as a statement, it is assumed to; so, the way to get it to expand as an expression is to put the macro invocation into an expression context, e.g. wrapped in parens, as you've done.
The following results in a parse error:
While e.g. the following, where the method call expression is wrapped in parentheses, does not:
It seems as though the macro is assumed to expand to a statement if it is placed where a statement is allowed, causing an error even though it actually expands to an expression.
The Macros Tutorial says that macros are parsed as (paraphrased) "appropriate placeholders". Shouldn't this placeholder permit being treated as an expression even in a context where it isn't yet known whether it is an expression or not?
The text was updated successfully, but these errors were encountered: