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

Core Erlang Scope Leaking

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 22.0
    • Fix Version/s: 22.2
    • Component/s: compiler
    • Labels:
      None

      Description

      OS: "Windows 10 Home, 10.0.18362"
      release: "Erlang/OTP","22","10.4"

      Consider the following Core Erlang function in a module:

      'fun1'/0 =
          fun() ->
              let Y = {let Z = fun() -> 5 in apply Z(), apply Z()} in
                  apply Z()
      

      I think that this function shouldn't compile, because "Z" is neither visible in the "in" clause nor in the second member of the tuple, but it compiles and "fun1" can be called successfully (resulting "5"). In addition, if I change the previous code a little:

      'fun1'/0 =
          fun() ->
              let Y = {let Z = fun() -> 5 in 1, apply Z()} in
                  apply Z()
      

      Then the compiler throws an error correctly.

      Note: This behavior was not present with OTP 21.

        Attachments

          Activity

            People

            Assignee:
            bjorn Björn Gustavsson
            Reporter:
            berpeti Péter Bereczky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: