-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Allow to prune metadata while escaping #7949
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
Conversation
We use this option in ExUnit as we are escaping the code to eventually convert it to a string representation and therefore the metadata is not relevant.
4526e7f
to
b4c3ea9
Compare
Just wanted to chime in here and let you know that this PR solves the problem I was seeing - the tests that were previously failing due to |
This looks good, but I'm still not sure when I would use something like this writing code in Elixir - could you give some examples and explanation why it's necessary, @josevalim? |
@michalmuskala done! please let me know if it is clearar now! |
lib/elixir/lib/macro.ex
Outdated
As an example, `ExUnit` stores the AST of every assertion, so when | ||
an assertion fails we can show code snippets to users. Without this | ||
option, each time the test module is compiled, we get a different | ||
MD5 of the module byte code, because the AST contains metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is something missing in this part:
because the AST contains metadata specific, such as counters, specific the compilation environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One word too many! Tks, fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
But, might a ”to” be missed too? Right now it reads “because the AST contains metadata specific the compilation environment”, should it be “because the AST contains metadata specific to the compilation environment”?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch again! :D
Looks good to me :) |
❤️ 💚 💙 💛 💜 |
@josevalim any chance this gets backported into 1.6? |
@arjan the feature or the fix? |
Good question, b4c3ea9 I guess, it's for this library. cc @bitwalker |
@josevalim I'd be curious to know which release this would fall in, and if backporting to 1.6 is an option (assuming it's in 1.7), that'd open up the ability to use libraries like the one linked with current applications which may not upgrade for some time, though I'm not too concerned about that if it'll be in 1.7. If it's not going to be in 1.7 either, that'd be a problem for my library, but if there are problems with dropping it that soon, I just need to provide people with instructions on how to use master in the meantime. |
We have backported to v1.7. We won’t backport it to v1.6 though as from
today v1.7 is the main branch for bug fixes.
--
*José Valimwww.plataformatec.com.br
<http://www.plataformatec.com.br/>Founder and Director of R&D*
|
Thanks José! Sounds good to me :) |
We use this option in ExUnit as we are escaping the code to eventually convert it to a string representation and therefore the metadata is not relevant. Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
We use this option in ExUnit as we are escaping
the code to eventually convert it to a string
representation and therefore the metadata is not
relevant.
Closes #7947.