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

Call to a generic function that expects argument to conform a protocol fails if argument compose multiple protocols.

    XMLWordPrintable

    Details

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

      Description

      Following code cause a error — Cannot invoke `foo` with an argument list of type `(bar: A & B)`:

      protocol A {}
      protocol B {}
      class C: A, B {}
      func foo<T>(bar: T) where T: A {}
      let c: A & B = C()
      foo(bar: c)
      

      If c defined as following, everything works:

      let c: A = C()
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              nikita Nikita Leonov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: