title: "self as?" within protocol extension
body: <p>I was trying for casting "self" within protocol extension. It crashed with EXC_BAD_ACCESS error when running on real device but worked well on simulator. What should I do to make this work? Thanks</p>
  
  <p>My whole code:</p>
  
  <pre><code>protocol SomeProtocol: class {
  
  }
  
  protocol DataSetEditable {
      func add(_ data: Data)
  }
  
  extension DataSetEditable where Self: SomeClass {
      func add(_ data: Data) {
          print(data)
          if let someProtocol = self as? SomeProtocol {
              print(someProtocol)
              //do some extra works
          }
      }
  }
  
  class SomeClass: UIView {
  
  }
  
  class MyClass: SomeClass, DataSetEditable, SomeProtocol {
  }
  
  class ViewController: UIViewController {
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          let myClass = MyClass()
          myClass.add(Data())
      }
  }
  </code></pre>