<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="">Thanks Jordan!<div class=""><br class=""></div><div class="">I can definitely file an issue.</div><div class=""><br class=""></div><div class="">A better diagnostic would definitely help.</div><div class=""><br class=""></div><div class="">James</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 15, 2017, at 2:03 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>> 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=""><div class="">Hi, James. The trick here is that the name you’ll get in Swift for these methods is probably 'compareQuery(_:toQuery:)', because the Swift compiler detects that the “result” is redundant with the type name. In Xcode 8 the compiler didn’t check if you were using the “old" name to satisfy a protocol, but Xcode 9 now does (for unrelated reasons).</div><div class=""><br class=""></div><div class="">Since this is a source-breaking change, can you file an issue at <a href="https://bugs.swift.org/" class="">https://bugs.swift.org</a> ? At the very least we should make the diagnostic better.</div><div class=""><br class=""></div><div class="">You can always tell the Swift compiler you know better by using the NS_SWIFT_NAME annotation to provide an alternate name, using Swift function name syntax.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 15, 2017, at 12:45, James Dempsey via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> 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=""><div class="">I am updating from Xcode 8 to Xcode 9, still using Swift 3.</div><div class=""><br class=""></div><div class="">In my project I am getting warnings of the pattern:</div><div class=""><br class=""></div><font face="Menlo" class="">Unavailable instance method ‘compareQueryResult(_:toQueryResult:)’ was used to satisfy a requirement of protocol ‘ResultComparable’.</font><div class=""><br class=""></div><div class="">My project uses an Obj-C++ framework to wrap C++ and expose it in Obj-C.</div><div class=""><br class=""></div><div class=""><div class="">The instance method in question is declared and implemented in a number of Obj-C classes in this framework.</div></div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><font color="#ba2da2" class=""><span style="background-color: white;" class="">@interface</span></font> DocumentQuery: <font color="#4f8187" class=""><span style="background-color: white;" class="">Query</span></font> {</font></div><font face="Menlo" class=""> - (<font color="#4f8187" class=""><span style="background-color: white;" class="">ComparisonResult</span></font>)compareQueryResult:(<font color="#4f8187" class=""><span style="background-color: white;" class="">DocumentResult</span></font> *)result1 toQueryResult:(<font color="#4f8187" class=""><span style="background-color: white;" class="">DocumentResult</span></font> *)result2;<br class=""></font><div class=""><font face="Menlo" class="">}</font></div><div class=""><font color="#ba2da2" face="Menlo" class=""><span style="background-color: white;" class="">@end</span></font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class=""><font color="#ba2da2" class=""><span style="background-color: white;" class="">@interface</span></font> GroupQuery: <font color="#4f8187" class=""><span style="background-color: white;" class="">Query</span></font> {</font></div><div class=""><font face="Menlo" class=""> - (<font color="#4f8187" class=""><span style="background-color: white;" class="">ComparisonResult</span></font>)compareQueryResult:(<font color="#4f8187" class=""><span style="background-color: white;" class="">GroupResult</span></font> *)result1 toQueryResult:(<font color="#4f8187" class=""><span style="background-color: white;" class="">GroupResult</span></font> *)result2;</font></div><div class=""><font face="Menlo" class="">}</font></div><div class=""><font color="#ba2da2" face="Menlo" class=""><span style="background-color: white;" class="">@end</span></font></div><div class=""><br class=""></div><div class=""><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">Another framework imports the Obj-C++ framework. In this framework the protocol is defined in Swift with an associated type:</div><div class=""><br class=""></div><font face="Menlo" class=""><font color="#ba2da2" class=""><span style="background-color: white;" class="">public</span></font> <font color="#ba2da2" class=""><span style="background-color: white;" class="">protocol</span></font> ResultComparable<br class="">{<br class=""> <font color="#ba2da2" class=""><span style="background-color: white;" class="">associatedtype</span></font> ResultType<br class=""> <font color="#ba2da2" class=""><span style="background-color: white;" class="">func</span></font> compareQueryResult(_ r1: </font><span style="color: rgb(112, 61, 170); font-family: Menlo; background-color: rgb(255, 255, 255);" class="">ResultType</span><font face="Menlo" class="">, toQueryResult r2: </font><span style="color: rgb(112, 61, 170); font-family: Menlo; background-color: rgb(255, 255, 255);" class="">ResultType</span><font face="Menlo" class="">) -> </font><font color="#703daa" face="Menlo" class=""><span style="background-color: white;" class="">ComparisonResult</span></font><font face="Menlo" class=""><br class="">}<br class=""><br class=""></font><div class=""><div class="">And conformance is declared:</div><div class=""><br class=""></div><div style="font-size: 9px;" class=""><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">extension</span><span style="" class=""> </span>DocumentQuery<span style="" class="">: </span>ResultComparable<span style="" class=""> {}</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(186, 45, 162);" class="">extension</span><span style="" class=""> </span>GroupQuery<span style="" class="">: </span>ResultComparable<span style="" class=""> {}</span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><span style="" class=""><br class=""></span></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><div style="font-family: Helvetica;" class="">This compiled without warnings in Xcode 8 / Swift 3, but they appear in Xcode 9 / Swift 3. Any help in understanding the issue and how to fix it would be greatly appreciated.</div><div style="font-family: Helvetica;" class=""><br class=""></div><div style="font-family: Helvetica;" class="">James</div></div><div style="margin: 0px; font-size: 12px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135); background-color: rgb(255, 255, 255);" class=""><br class=""></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=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></body></html>