Skip to content
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

erl_syntax:set_pos/2 or erl_syntax:revert/1 is not works as expected #4668

Open
slepher opened this issue Mar 24, 2021 · 1 comment
Open
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community priority:low team:VM Assigned to OTP team VM

Comments

@slepher
Copy link

slepher commented Mar 24, 2021

Describe the bug
erl_syntax:set_pos/2 or erl_syntax:revert/1 is not works as expected

Node = {atom, 20, a}.
Node1 = erl_syntax:revert(erl_syntax:set_pos(Node, 10)).
?assertEqual({atom, 10, a}, Node).

assertEqual above fails.

Reason
erl_syntax use a wrapper to wrap erl_parse tree and erl_syntax:set_pos/2 only changes #wrapper.attr in wrapper record
while use erl_syntax:revert/1 #wrapper.attr is dropped, original pos in erl_parse tree is not changed

Affected versions
OTP 23 and higher

@slepher slepher added the bug Issue is reported as a bug label Mar 24, 2021
@rickard-green rickard-green added team:VM Assigned to OTP team VM help wanted Issue not worked on by OTP; help wanted from the community priority:low labels Mar 29, 2021
@MarkoMin
Copy link
Contributor

MarkoMin commented Sep 27, 2024

I believe that this is solved by #7398

In OTP27, the assertion above succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community priority:low team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants