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

Invalid behaviour of erl_tidy with macros inside a function headers.

    XMLWordPrintable

    Details

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

      Description

      erlang 22.0.7
      macOS Catalina version 10.15 Beta
      default install from brew

      I had this example file

      -module(test).
      
      -export([test/2]).
      
      -define(TEST_MACRO(Param), Param).
      
      test(?TEST_MACRO(Param), Value) ->
          case Param of
            true -> true;
            false -> Value
          end.
      

      then I called

       erl_tidy:file(Name, [{stdout, true}]) 

      and got this:

      -module(test).
      
      -export([test/2]).
      
      -define(TEST_MACRO(Param), Param).
      
      test ( ? TEST_MACRO ( Param ) , Value ) -> case Param of true -> true ; false -> Value end .
      

      But when I deleted ?TEST_MACRO in a function header I got a correct result:

      -module(test).
      
      -export([test/2]).
      
      -define(TEST_MACRO(Param), Param).
      
      test(Param, Value) ->
          case Param of
            true -> true;
            false -> Value
          end.
      

      Also when I tried it with an old version of erlang (19.3.6.13) it worked correctly in both cases.

        Attachments

          Activity

            People

            Assignee:
            otp_team_vm Team VM
            Reporter:
            evilbluebeaver evilbluebeaver
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: