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

Protocol with associatedtype constrained to another protocol & inheritance does not compile

    XMLWordPrintable

    Details

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

      Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42) on macOS Sierra 10.12.5

      Description

      Given the following three protocol and one class:

      protocol View { }
      
      protocol ExtendedView: View {
          func foo()
      }
      
      protocol Presenter {
          associatedtype ConcreteView: View
          func attach(view: ConcreteView)
      }
      
      class APresenter: Presenter {
          typealias ConcreteView = ExtendedView
          func attach(view: ExtendedView) { }
      }
      

      the compiler produces the following error:

      {{Error:(25, 7) type 'APresenter' does not conform to protocol }}'Presenter'

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              nosyjoe Philipp Engel
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: