title: Swift Generic struct conform to protocol with associatedType got "Cannot convert return expression of type 'String' to return type 'Key'" Error
body: <pre class="lang-swift prettyprint-override"><code>protocol Container {
      associatedtype ItemType
      func getItem() -&gt; ItemType
      func getItems() -&gt; [ItemType]
  }
  
  struct TypedBackpack&lt;TypedItemType: StringProtocol&gt;: Container {
      func getItem() -&gt; TypedItemType {
          return &quot;&quot;
      }
      
      func getItems() -&gt; [TypedItemType] {
          return [&quot;&quot;]
      }
  }
  
  struct KeyBackpack&lt;Key: Sequence&gt;: Container {
      func getItem() -&gt; Key { //&quot;Error: Cannot convert return expression of type 'String' to return type 'Key'&quot;
          return &quot;&quot;       
      }
      func getItems() -&gt; [Key] { //&quot;Error: Cannot convert return expression of type 'String' to return type 'Key'&quot;
          return [&quot;&quot;]
      }
  }
  </code></pre>
  <p>I got &quot;Error: Cannot convert return expression of type 'String' to return type 'Key'&quot; for &quot;getItem()&quot; and &quot;getItems()&quot; functions in KeyBackPack.
  However, TypedBackPack is working fine.</p>
  <p>If I change KeyBackPack to:</p>
  <pre class="lang-swift prettyprint-override"><code>struct KeyBackpack&lt;Key: StringProtocol&gt;: Container {
      func getItem() -&gt; Key {
          return &quot;&quot;       
      }
      func getItems() -&gt; [Key] { 
          return [&quot;&quot;]
      }
  }
  </code></pre>
  <p>Everything works fine. So the problem is &quot;&lt;Key: Sequence&gt;&quot;. Can anybody tell me why &lt;Key: StringProtocol&gt; works fine but &lt;Key: Sequence&gt; doesn't?</p>