-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Captured block parameter not recognised when used inside macro #14727
Comments
This is not exacty #7975. The variable is not declared within the macro. It's only used there. But it seems to be a similar issue. The compiler determines whether a block argument is a caputered block depending on whether the variable is referenced in the method body. Apparently it cannot recognise it when inside a macro. It's easy to work around by inserting an explicit reference to the block variable outside the macro. def assert(cond, &err : -> String)
err
{% if flag?(:debug) %}
raise err.call unless cond
{% end %}
end |
my test code
compile result
try online: https://play.crystal-lang.org/#/r/gxy9
The text was updated successfully, but these errors were encountered: