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

Consolidate CC #21863

Merged
merged 35 commits into from
Nov 22, 2024
Merged

Consolidate CC #21863

merged 35 commits into from
Nov 22, 2024

Commits on Nov 22, 2024

  1. Recognize double annotated capabilities such as x*?

    x*? is x.type @reach @maybe. This was not recognized before.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    f5c9eab View commit details
    Browse the repository at this point in the history
  2. Refactor narrowCaps

    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    bbafb09 View commit details
    Browse the repository at this point in the history
  3. Make sure dcs includes cs

    Previously, we violated that assumption is we too the deep capture set
    of a capture reference wiht singleton type.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    d33c89a View commit details
    Browse the repository at this point in the history
  4. Align deep capture sets with reach capabilities

    Count in dcs exactly those locations where a cap gets replaced by a reach capability.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    cdd03b7 View commit details
    Browse the repository at this point in the history
  5. Refactor handling of applications

    Simplify code that handles applications, avoiding adding pieces of mutable state.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    822550d View commit details
    Browse the repository at this point in the history
  6. Handle reach capabilities correctly in markFree

    The correct point to address charging reach capabilities is in markFree itself:
    When a reach capability goes out of scope, and that capability is not a parameter,
    we need to continue with the underlying capture set.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    e7c018b View commit details
    Browse the repository at this point in the history
  7. Rename @unbox to @use

    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    fcf4045 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7c2a76b View commit details
    Browse the repository at this point in the history
  9. Drop curried use scheme

    Drop the scheme where we only charge the last arrow of a curried lambda with
    elements used in the body. On the one hand, this is unsound without compensation
    measures (like, restricting to reach capabilities, or taking all capture sets
    of a named curried function as the underlying reference). On the other hand, this
    should be generalized to all closures and anonymous functions forming the right
    hand sides of methods.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    2747f03 View commit details
    Browse the repository at this point in the history
  10. Stop markFree at nested methods

    Use sets of nested methods are anyway charged on call.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    17a4a8c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    02cd565 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    e6b08de View commit details
    Browse the repository at this point in the history
  13. Re-enable handleEtaExpansionsSpecially setting

    This gives better error messages. Previously we thought this would
    make reach capabilities unsound, but I don't see an issue with the latest
    design.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    fd9e895 View commit details
    Browse the repository at this point in the history
  14. Disable reach capabilities in nested closures appearing without @use

    With our current @use scheme, this is unsound. We leave the possibility to re-enable
    as a Config option which is disabled by default and comes with a warning that enabling
    it would be unsound.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    4226a33 View commit details
    Browse the repository at this point in the history
  15. Go back to sealed checking

    Check that type parameters of methods and parent traits don't get instantiated
    with types containing a `cap` anywhere in covariant or invariant position.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    8f8a15f View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    62b2f1c View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    0676450 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    96d1610 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    adf6a25 View commit details
    Browse the repository at this point in the history
  20. Fix dcs for invariant type parameters

    Also: add test that reach capabilities are contained inside boxes
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    496c866 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    f4c09e3 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    c4c69b0 View commit details
    Browse the repository at this point in the history
  23. Be more careful computing underlying types of reach capabilities

    We can use the dcs only if there are no type variables.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    91da9fb View commit details
    Browse the repository at this point in the history
  24. Polish code of markFree

    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    34e947a View commit details
    Browse the repository at this point in the history
  25. Revert change to Iterator

    The additional purity in the asInstanceOf target is not needed
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    eb0577f View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    2b51ee9 View commit details
    Browse the repository at this point in the history
  27. Drop legacy caps.unsafe operations

    Retain only caps.unsafe.unsafeAssumePure
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    b9d485a View commit details
    Browse the repository at this point in the history
  28. Don't show redudundant existental wrappers

    Don't show an `(ex$n: Exists) ->` if the bound variable
    does not appear in the result. The full type will be shown under -Ycc-debug.
    
    Also, avoid spurious ineffective mappings in widenReach.
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    1e79a2d View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    ff73a2f View commit details
    Browse the repository at this point in the history
  30. Treat by-name closures specially in recheck

    A by-name Closure node, which is produced by phase ElimByName gets a target type to indicate
    it's a contextual zero parameter closure. But for the purposes of rechecking and capture checking,
    it needs to be treated like a function. In particular the type of the closure needs to be derived
    from the result type of the anonymous function.
    
    Fixes scala#21920
    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    a98903c View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    d8ea08d View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    e309d5a View commit details
    Browse the repository at this point in the history
  33. Address review comments

    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    6f51fc0 View commit details
    Browse the repository at this point in the history
  34. Fix rebase breakage

    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    da14277 View commit details
    Browse the repository at this point in the history
  35. Fix more rebase breakage

    odersky committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    353f80b View commit details
    Browse the repository at this point in the history