Uploaded image for project: 'Swift'
  1. Swift
  2. SR-7563

Generic class with AnyObject constraint won't except protocol that also has AnyObject constraint

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Duplicate
    • Component/s: Compiler
    • Labels:
      None
    • Environment:

      Xcode 9.3

      macOS 10.13.4

      Swift 4.1

      Description

      This feels like it should be possible but maybe I am just being naive?

      import Foundation
      
      class A<ClassDelegate: AnyObject> {
          weak var delegate: ClassDelegate?
      }
      
      protocol P: AnyObject {}
      
      class B: A<P> {}
      

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              kdawgwilk Kaden Wilkinson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: