<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I don’t remember the details, but IIRC ‘Iterator’ is an inferred associated type on Array, so it cannot appear in the ‘where’ clause of an extension. This is a known limitation of the name lookup code — presently it cannot recur into associated type inference due to circularity. We plan on addressing this with the ‘iterative declaration checker’, but that is some ways off.<div class=""><br class=""></div><div class="">Slava<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 31, 2016, at 5:28 AM, Toni Suter via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">This extension on Array works as expected:<br class=""><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">extension Array where Element: CustomStringConvertible {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">&nbsp; &nbsp; func f(_ x: Element) -&gt; String {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; return x.description</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">&nbsp; &nbsp; }</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">}</font></div></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">But when I use Iterator.Element instead, I get an error message (<span style="color: rgb(242, 0, 4); font-family: Monaco;" class="">error: value of type 'Element' has no member 'description'</span>):</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">extension Array where Iterator.Element: CustomStringConvertible {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">&nbsp; &nbsp; func f(_ x: Iterator.Element) -&gt; String {</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">&nbsp; &nbsp; &nbsp; &nbsp; return x.description</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">&nbsp; &nbsp; }</font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Monaco" class="">}</font></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">I assume this is a type checker bug, but before I report it, I wanted to make sure that that’s really the case. Or is there a difference between Element and</div><div style="margin: 0px; line-height: normal;" class="">Iterator.Element?</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Thanks and best regards,</div><div style="margin: 0px; line-height: normal;" class="">Toni</div></div></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></div></body></html>