<div dir="ltr"><div>Hi all!</div><div><br></div><div>Can someone please explain the rationale behind the last line printing</div><div>&quot;T is unknown&quot;</div><div>rather than (what I would expect):</div><div>&quot;T is Int&quot;</div><div>in the following program?</div><div><br></div><div><br></div><div>protocol P {</div><div>    associatedtype T</div><div>    func f() // *</div><div>}</div><div>extension P {</div><div>    func f() { print(&quot;T is unknown&quot;) }</div><div>}</div><div>extension P where T == Int {</div><div>    func f() { print(&quot;T is Int&quot;) }</div><div>}</div><div><br></div><div>struct X&lt;T&gt; : P {}</div><div><br></div><div>struct Y&lt;U&gt; where U: P, U.T == Int {</div><div>    // NOTE: The compiler/type-checker knows that U.T == Int here so ...<br></div><div>    typealias T = U.T</div><div>    var a: U</div><div>    func g() { a.f() } // ... how/why could this print anything but &quot;T is Int&quot;?</div><div>}</div><div><br></div><div>let x = X&lt;Int&gt;()</div><div>x.f() // Prints &quot;T is Int&quot;, no matter if * is commented out or not.</div><div><br></div><div>let y = Y(a: X&lt;Int&gt;())</div><div>y.g() // Prints &quot;T is unknown&quot; unless * is commented out. Why?</div><div><br></div><div><br></div><div>IMHO this looks like the compiler simply ignores that struct Y&lt;U&gt; has the constraint  U.T == Int.</div><div>How else to explain this behavior?</div><div>/Jens<br></div><div><br></div></div>