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

Fix support for non-final classes in AtomicReference #58

Merged
merged 3 commits into from
Mar 20, 2023

Commits on Mar 17, 2023

  1. Fix support for non-final classes in AtomicReference

    Swift 5.6/7 generates new compiler warnings when non-final classes
    conform to `AtomicReference`. The warnings are pointing out a real
    design issue: Self is covariant in protocols, but we intend atomic
    operations to always deal with the base class rather than individual
    subclasses.
    
    Add a new associated type requirement to AtomicValue to represent the
    actual type that originally conformed to the protocol, and add
    explicit same-type requirements to clients to ensure they aren’t
    asked to return a subclass.
    
    Unfortunately, this change is source breaking:
    
    ```
    class Base: AtomicReference {}
    class Derived: Base {}
    
    let ref = ManagedAtomic<Derived?>(nil)
      // before: OK
      // after: 'ManagedAtomic' requires the types 'Derived' and 'Base' be equivalent
    ```
    lorentey committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    cc86c55 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2023

  1. Configuration menu
    Copy the full SHA
    5730529 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2023

  1. Configuration menu
    Copy the full SHA
    907ce2a View commit details
    Browse the repository at this point in the history