title: Protocol can an only be used as a generic constraint because it has Self or associated type requirements
body: <p>Following on from an answer to my <a href="https://stackoverflow.com/questions/50346052/protocol-extending-encodable-or-codable-does-not-conform-to-it">previous question</a>, I have 2 protocols…</p>
  
  <pre><code>protocol Filters: Encodable { 
  }
  
  protocol QueryParameters: Encodable {
      associatedtype T: Filters
      var page: Int { get }
      var filters: T { get }
  }
  </code></pre>
  
  <p>and then for a type <code>Transaction</code>, I have…</p>
  
  <pre><code>struct TransactionFilters: Filters {
      var isWithdrawal: Bool
  }
  
  struct TransactionParamters&lt;T: Filters&gt;: QueryParameters {
      var page: Int
      var filters: T
  }
  </code></pre>
  
  <p>All good so far.</p>
  
  <p>Next I add a protocol, <code>Filterable</code>, and I'd like any type that conforms to <code>Filterable</code> to be able to return parameters, like this…</p>
  
  <pre><code>protocol Filterable {
      func parameters() -&gt; QueryParameters
  }
  
  struct Transactions: Filterable {
      func parameters() -&gt; QueryParameters {
          let transactionFilters = TransactionFilters(isWithdrawal: true)
          return TransactionParamters(page: 1, filters: transactionFilters)
      }
  }
  </code></pre>
  
  <p>but I end up with…</p>
  
  <blockquote>
    <p>error: protocol 'QueryParameters' can only be used as a generic constraint because it has Self or associated type requirements</p>
  </blockquote>
  
  <p>This seems a pretty straightforward requirement, but I've spent 2 days trying all combinations I could think of to get it to work. Now I'm finally admitting defeat.</p>
  
  <p>What do I need to do to resolve this?</p>