title: PAT typealias is ambiguous for type lookup in this context
body: <p>In trying to subclass my base class that conforms to a PAT, I get this compiler warning:</p>
  
  <blockquote>
    <p>'MyType' is ambiguous for type lookup in this context</p>
  </blockquote>
  
  <p>in my code as shown below:</p>
  
  <pre><code>protocol DataSourceProtocol {
      associatedtype MyType
      func get () -&gt; MyType
  }
  
  class AnyDataSource: DataSourceProtocol {
      typealias MyType = EntityProtocol
      func get() -&gt; MyType { fatalError("No implementation") }
  }
  
  class DataSource_A&lt;T: EntityProtocol &amp; DataSource_A_Compatible&gt;: AnyDataSource {
      typealias MyType = T
      override func get() -&gt; MyType { // &lt;-- 'MyType' is ambiguous for type lookup in this context
          return T()
      }
  }
  
  class DataSource_B&lt;T: EntityProtocol &amp; DataSource_B_Compatible&gt;: AnyDataSource {
      override func get() -&gt; MyType {
          return T()
      }
  }
  </code></pre>
  
  <p>I am trying to  override the method <code>get() -&gt; MyType</code> so that the <code>DataSource_A</code> instance method returns a specialized type T, hence <code>typealias MyType = T</code></p>
  
  <p>If I change the <code>DataSource_A</code> method to <code>override func get -&gt; T</code>, the compiler says that the function does not override any method in its superclass.</p>
  
  <p>In <code>DataSource_B</code>, the overridden method is called but provides no type information for type <code>T</code> because the caller receives type <code>EntityProtocol</code> which is not sufficient.</p>
  
  <p>If I remove the function declaration in <code>DataSourceProtocol</code> and in the base class <code>AnyDataSource</code>, and simply declare it in the subclass, it works fine, but I want to make the method's implementation mandatory for any subclass of <code>AnyDataSource</code>.</p>
  
  <p>Why can't I specify that the overridden method returns an object of type T by changing the value of <code>MyType</code> in the subclass?</p>