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

Compiler incorrectly emits a warning about an unused variable/binding

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 23.0
    • Fix Version/s: None
    • Component/s: compiler
    • Labels:
      None

      Description

      Team RabbitMQ's Erlang master pipeline detected an issue with Rebar bootstrap.

      Starting on December 2nd, the compiler started to (seemingly incorrectly) produce an unused variable warning on this line [1]. The message reads:

      src/r3_hex_tarball.erl:204: Warning: the result of the expression is ignored (suppress the warning by assigning the expression to the _ variable)
      

      The line reads:

      _Version = maps:get("VERSION", Files),
      

      which seems to be correctly prefixed.

      Steps to reproduce:

      1. Build OTP master
      2. Clone github.com/erlang/rebar3
      3. Run `DEBUG=1 ./bootstrap` in the repo
      4. Observe the error
      5. Change the line to read `_ = maps:get("VERSION", Files),`
      6. Rer-run the bootstrap
      7. Observe a successful build

      So looks like the compiler is being too strict about what _Unused variables are treated as such.

      1. https://github.com/erlang/rebar3/blob/master/src/r3_hex_tarball.erl#L204

        Attachments

          Activity

            People

            Assignee:
            bjorn Björn Gustavsson
            Reporter:
            michaelklishin2 Michael Klishin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: