Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1429

epp_dodger can't handle parametrized macros in function heads

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Help Wanted
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

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

      -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. 

      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:

      % 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 

      Even if not the prettiest code, the above module compiles correctly, so it should be considered valid Erlang code.

        Attachments

          Activity

            People

            Assignee:
            otp_team_vm Team VM
            Reporter:
            robertoaloi Roberto Aloi
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: