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

Class existentials don't conform to protocols that the class conforms to

    XMLWordPrintable

    Details

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

      Apple Swift version 4.0 (swiftlang-900.0.43 clang-900.0.22.8)
      Target: x86_64-apple-macosx10.9

      Description

      Protocols can't conform to themselves in the general case because of static requirements, but given class existentials comprise of a concrete type, the following should really compile:

      protocol P {}
      class Foo : P {}
      
      func foo<T : P>(_ t: T) {}
      
      let f: (Foo & P) = Foo()
      foo(f) // Cannot invoke 'foo' with an argument list of type '((Foo & P))'
      

      But currently doesn't.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              originaluser2 Hamish Knight
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: