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

Backport: nested function name canonicalization #179

Open
wants to merge 3 commits into
base: v1.10.2+RAI
Choose a base branch
from

Commits on Sep 23, 2024

  1. Canonicalize names of nested functions by keeping a more fine grained…

    … counter -- per (module, method name) pair (JuliaLang#53719)
    
    As mentioned in JuliaLang#53716, we've
    been noticing that `precompile` statements lists from one version of our
    codebase often don't apply cleanly in a slightly different version.
    
    That's because a lot of nested and anonymous function names have a
    global numeric suffix which is incremented every time a new name is
    generated, and these numeric suffixes are not very stable across
    codebase changes.
    
    To solve this, this PR makes the numeric suffixes a bit more fine
    grained: every pair of (module, top-level/outermost function name) will
    have its own counter, which should make nested function names a bit more
    stable across different versions.
    
    This PR applies @JeffBezanson's idea of making the symbol name changes
    directly in `current-julia-module-counter`.
    
    Here is an example:
    
    ```Julia
    julia> function foo(x)
               function bar(y)
                   return x + y
               end
           end
    foo (generic function with 1 method)
    
    julia> f = foo(42)
    (::var"#bar#foo##0"{Int64}) (generic function with 1 method)
    ```
    d-netto committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    bcc4ad5 View commit details
    Browse the repository at this point in the history
  2. Address review comment

    kpamnany authored and d-netto committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    2ec9986 View commit details
    Browse the repository at this point in the history
  3. fix is-method?

    d-netto committed Sep 23, 2024
    Configuration menu
    Copy the full SHA
    38af02c View commit details
    Browse the repository at this point in the history