<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">typealias now = not.</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif">Zhao Xin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 9, 2017 at 12:39 PM, Zhao Xin <span dir="ltr"><<a href="mailto:owenzx@gmail.com" target="_blank">owenzx@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">No, David, it is now allowed. "error: same-type requirement makes generic parameters 'Source' and 'Displacement' equivalent".</div><span class="HOEnZb"><font color="#888888"><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif">Zhao Xin</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 9, 2017 at 12:35 PM, David Sweeris via swift-users <span dir="ltr"><<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You could try putting that init in an extension "where Source == Displacement"<br>
<div class="m_-5485625742540109186HOEnZb"><div class="m_-5485625742540109186h5"><br>
> On Jul 8, 2017, at 21:06, Taylor Swift via swift-users <<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a>> wrote:<br>
><br>
> I have a type like<br>
><br>
> struct DistortedNoise<Source, Displacement> where Source:Noise, Displacement:Noise<br>
> {<br>
> let source:Source,<br>
> displacement:Displacement<br>
><br>
> init(source:Source, displacement:Displacement)<br>
> {<br>
> self.source = source<br>
> self.displacement = displacement<br>
> }<br>
><br>
> init(source:Source)<br>
> {<br>
> self.source = source<br>
> self.displacement = source<br>
> }<br>
> }<br>
><br>
> and I get the error<br>
><br>
> Compile Swift Module 'Noise' (5 sources)<br>
> /home/taylor/noise/sources/noi<wbr>se/noise.swift:576:29: error: 'Source' is not convertible to 'Displacement'<br>
> self.displacement = source<br>
> ^~~~~~<br>
><br>
> How do I tell Swift that I want the same type fulfilling both Source and Displacement?<br>
><br>
</div></div><div class="m_-5485625742540109186HOEnZb"><div class="m_-5485625742540109186h5">> ______________________________<wbr>_________________<br>
> swift-users mailing list<br>
> <a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-users</a><br>
______________________________<wbr>_________________<br>
swift-users mailing list<br>
<a href="mailto:swift-users@swift.org" target="_blank">swift-users@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank">https://lists.swift.org/mailma<wbr>n/listinfo/swift-users</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>