-
Notifications
You must be signed in to change notification settings - Fork 3k
28.0-rc2 erl_syntax:revert/1 doesn't roundtrip annotations for lists #9627
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
Comments
Could this be duplicate of #4802, or is this specific behaviour new in 28? |
This was working in OTP 27 (and on master back in December):
|
Regression seems due to b4bc274, as reverting it makes the issue go away |
It seems to just be my fix working as intended. As the commit stated, "avoids setting a wrong location for the nil". In the erl_syntax representation, the nil is not preserved as a separate thing (which could perhaps be considered a bug or at least a misfeature, but that's how it works). When reverting, a nil has to be made up. Previously, this used the start of the last element before the nil - which is why you see I had some plans to move forward with better general end position support in erl_syntax, but there are some questions about which modules in OTP may and may not make assumptions about how position info with end points are encoded. |
Note that it didn't roundtrip in OTP 27 either, it replaced 11 with 10. |
I agree with @richcarl, this is a bug in the (public and documented) |
Describe the bug
There is a regression in
erl_syntax:revert/1
: annotating the bindings on a syntax-tree and immediately reverting leads to the source position annotation fornil
getting lost.To Reproduce
Expected behavior
In
Reverted
, we should see{nil, {9,11}}
, instead we see{nil, 0}
Affected versions
28-rc2 (9834e60)
The text was updated successfully, but these errors were encountered: