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-1429: epp_dodger can't handle parametrized macros in function heads #4445

Closed
OTP-Maintainer opened this issue Dec 1, 2020 · 2 comments · Fixed by #2964
Closed

ERL-1429: epp_dodger can't handle parametrized macros in function heads #4445

OTP-Maintainer opened this issue Dec 1, 2020 · 2 comments · Fixed by #2964
Assignees
Labels
bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community priority:medium team:VM Assigned to OTP team VM

Comments

@OTP-Maintainer
Copy link

Original reporter: robertoaloi
Affected version: Not Specified
Component: Not Specified
Migrated from: https://bugs.erlang.org/browse/ERL-1429


An Erlang LS user reported a bug in the server which prevents code navigation in the following case (to the {{hello/1}} function).


{noformat}
-module(erlang_ls_goto).

-export([hello/1]).
-export([hi/1]).
-export([howdy/1]).

-define(HELLO(World), {hello, World}).
-define(HOWDY, howdy).

hello(?HELLO(World)) ->
    World.

hi({hi, World}) ->
    World.

howdy(?HOWDY) ->
    howdy. {noformat}

See the detailed discussion at: [https://github.com/erlang-ls/erlang_ls/issues/805]

We believe this is caused by an underlying issue in \{{epp_dodger}} itself, which is part of OTP. The minimal, reproducible example:


{noformat}
% 14:58:42 <0.1305.0>({erlang,apply,2})
% epp_dodger:fix_form([{atom,10,hello},
 {'(',10},
 {'(',0},
 {atom,10,'? <macro> ('},
 {'(',10},
 {var,10,'HELLO'},
 {',',10},
 {var,10,'World'},
 {')',10},
 {')',0},
 {')',10},
 {'->',10},
 {var,11,'World'},
 {dot,11}])

% 14:58:42 <0.1305.0>({erlang,apply,2})
% epp_dodger:fix_form/1 -> error {noformat}
Even if not the prettiest code, the above module compiles correctly, so it should be considered valid Erlang code.
@OTP-Maintainer
Copy link
Author

lukas said:

https://github.com/erlang-ls/erlang_ls/pull/852 fix in els_dodger, could be backported to fix epp_dodger.

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug help wanted Issue not worked on by OTP; help wanted from the community team:VM Assigned to OTP team VM priority:medium labels Feb 10, 2021
@bjorng bjorng self-assigned this Feb 19, 2021
@garazdawi
Copy link
Contributor

A potential solution in #2964

@bjorng bjorng linked a pull request Feb 19, 2021 that will close this issue
@bjorng bjorng closed this as completed Feb 20, 2021
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:medium team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants