Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Backport "Make more anonymous functions static" to LTS #20799

Merged
merged 3 commits into from
Jun 26, 2024
Merged

Commits on Jun 25, 2024

  1. Make more anonymous functions static

    An anonymous function in a static object was previously mapped to a member
    of that object. We now map it to a static member of the toplevel class instead.
    This causes the backend to memoize the function, which fixes #19224. On the
    other hand, we don't do that for anonymous functions nested in the object
    constructor, since that can cause deadlocks (see run/deadlock.scala).
    
    Scala 2's behavior is different: it does lift lambdas in constructors
    to be static, too, which can cause deadlocks.
    
    Fixes #19224
    
    [Cherry-picked 22a959a]
    odersky authored and WojciechMazur committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    18201cc View commit details
    Browse the repository at this point in the history
  2. Fix test and add more comments

    [Cherry-picked 5b8e6c9]
    odersky authored and WojciechMazur committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    6b42afa View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    26442fd View commit details
    Browse the repository at this point in the history