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

Can't call Objective-C generic class method from protocol extension.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: CodeCompletion, Compiler
    • Labels:
      None
    • Environment:

      Xcode 9.2, Swift 4.0.3

      Description

      I can't explain what is going on, but I can't call the method that is autocompleted, and definitely exists.

       

      protocol _PSPDFKVOController: class {}
      extension _PSPDFKVOController {
          func observe2<Value>(_ object: AnyObject, keyPath: KeyPath<Self, Value>, options: NSKeyValueObservingOptions = [], block: @escaping (NSKeyValueObservedChange<Value>) -> Void) -> NSKeyValueObservation? {
              let controller = self as! PSPDFKVOController<Value>
              controller.observe(controller, "", options: options) { (a, b, c) in // Error: Extra argument in call
                  // WAT?
              }
      }
      

       

      PSPDFKVOController is an Objective-C generic class

      See attached video to see what's going on.

        Attachments

        1. wat.gif
          619 kB
          Marcin Krzyzanowski

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            krzyzanowskim Marcin Krzyzanowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: