<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I agree that this is counterintuitive behaviour and should ideally be changed to match things like:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class=""> func</span> f <T> (<span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">_</span>: <span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">T</span>.Type) {}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro';" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class=""> func</span> f2 <T> (<span style="font-variant-ligatures: no-common-ligatures; color: #c8ace5" class="">_</span>: <span style="font-variant-ligatures: no-common-ligatures; color: #49a2d2" class="">T</span>.Type) {}</div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; min-height: 15px;" class=""><br class=""></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(73, 162, 210);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class=""> f</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span>Int<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: 'Source Code Pro'; color: rgb(73, 162, 210);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #91540f" class=""> f2</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span>String<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">milos</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""><br class=""></span></div><div><blockquote type="cite" class=""><div class="">On 5 Apr 2016, at 17:16, Noah Blake via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Types associated with a protocol are not namespaced by the protocol, but rather by the protocol's adopters. As such, when two protocols declare a common associatedType, adoption of those protocols introduces undesirable ambiguity.<br class=""></div><div class=""><br class=""></div><div class="">Given the understandable propensity of developers to arrive at similarly named types (T, for example), it is likely that this problem will reduce the compatibility of packages for reasons that may not be entirely clear to the package consumer.</div><div class=""><br class=""></div><div class="">Here is a demonstration of the issue. Apologies, I'm a longtime reader of the list, but this is my first time posting, and I'm not sure how best to format this. You may also find this example on Jira (<a href="https://bugs.swift.org/browse/SR-1065" class="">https://bugs.swift.org/browse/SR-1065</a>).</div><div class=""><br class=""></div><div class="">```</div><div class="">protocol A {</div><div class=""> associatedtype T</div><div class=""> var aT: T { get }</div><div class="">}</div><div class=""><br class=""></div><div class="">protocol B {</div><div class=""> associatedtype T</div><div class=""> var bT: T { get }</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class="">T is ambiguous: "Type C does not conform to protocol 'B'."</div><div class="">```</div><div class="">class C: A, B {</div><div class=""> var aT = String()</div><div class=""> var bT = Int()</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">T is inferred unambiguously, compiles without error.</div><div class="">```</div><div class="">class C: A, B {</div><div class=""> var aT = String()</div><div class=""> var bT = String()</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class="">T is explicit, but problematic: "Type C does not conform to protocol 'A'."</div><div class="">```</div><div class="">class C: A, B {</div><div class=""> typealias T = Int</div><div class=""> var aT = String()</div><div class=""> var bT = Int()</div><div class="">}</div><div class="">```</div><div class=""><br class=""></div><div class="">I would greatly appreciate any advice or direction as to next steps. I have a proposal for resolving this in mind, but it seemed premature to offer it before finding some agreement that this was worth carrying forward.</div><div class=""><br class=""></div><div class="">Best regards,</div><div class="">Noah Blake</div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>