<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;">Diagnostics improved in r<span style="font-family: Menlo; font-size: 11px;">196828. fixits are planned and will come in a later patch.</span><div><font face="Menlo"><span style="font-size: 11px;"><br></span></font><div><font face="Menlo"><span style="font-size: 11px;">- Thanks, Fariborz</span></font></div><div><font face="Menlo"><span style="font-size: 11px;"><br></span></font><div><div>On Dec 9, 2013, at 9:24 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Dec 6, 2013, at 16:34 , Fariborz Jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+// objc_bridge_related attribute diagnostics.</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+def err_objc_bridged_related_invalid_class : Error<</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+  "could not find ObjectiveC class %0 to convert %1 to %2">;</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+def err_objc_bridged_related_invalid_class_name : Error<</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+  "%0 must be name of an ObjectiveC class to be able to convert %1 to %2">;</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+def err_objc_bridged_related_class_method : Error<</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+  "class method %0 for conversion of CF type %1 to an "</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+ "ObjectiveC object of type %2 not found">;</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote><div><blockquote type="cite">+def err_objc_bridged_related_instance_method : Error<<br>+  "instance method %0 for conversion of an ObjectiveC type %1 to a CF "<br>+ "object  of type %2 not found">;<br></blockquote><br></div><div>I don't think this is the right message to show to a user. The actual error is something like "you can't convert an X to a Y without using method -Z". The fact that method -Z isn't visible right now probably just means the user hasn't imported a header.</div><div><br></div><div>I understand the motivation to help framework authors get the annotations right, but I think we still have to phrase all our diagnostics for the application programmer. I would just unconditionally use the diagnostic below, but only use the fix-it if the method is visible.</div><br><br><blockquote type="cite"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+def err_objc_bridged_related_known_method : Error<</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+ "%0 must be explicitly converted to %1, use %2 method for this conversion">;</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote><div><br></div>Semicolon instead of comma here? (And..."%select{%objcclass2|%objcinstance2}3", maybe? I think the "-" or "+" is important.)</div><div><br></div><div><br><blockquote type="cite"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+def err_objc_bridged_related_unknown_method : Error<</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+ "%0 must be explicitly converted to %1, define and then use "</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">+ "%select{a singular class|an instance}3 method in %2 for this conversion">;</span><br style="font-family: Monaco; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote></div><div><br></div><div>I don't think this is the correct fix in most cases. Most of the time people are just trying to convert things that don't have an established conversion path, and they're not going to go add a category to the system frameworks to do it. I think I would just stick to a generic error here.</div><div><br></div><div>Also, "Objective-C", please, for all of these.</div><div><br></div><div><br></div><div></div><blockquote type="cite"><span style="font-family: Monaco; font-size: 10px;">+  foo(newColor); // expected-error {{'CGColorRef' (aka 'struct CGColor *') must be explicitly converted to 'NSColor *', use 'colorWithCGColor:' method for this conversion}} \</span><br style="font-family: Monaco; font-size: 10px;"><span style="font-family: Monaco; font-size: 10px;">+</span><span class="Apple-tab-span" style="font-family: Monaco; font-size: 10px; white-space: pre;">   </span><span class="Apple-tab-span" style="font-family: Monaco; font-size: 10px; white-space: pre;">    </span><span style="font-family: Monaco; font-size: 10px;"> // expected-error {{implicit conversion of C pointer type 'CGColorRef' (aka 'struct CGColor *') to Objective-C pointer type 'NSColor *' requires a bridged cast}} \</span><br style="font-family: Monaco; font-size: 10px;"><span style="font-family: Monaco; font-size: 10px;">+</span><span class="Apple-tab-span" style="font-family: Monaco; font-size: 10px; white-space: pre;">      </span><span class="Apple-tab-span" style="font-family: Monaco; font-size: 10px; white-space: pre;">    </span><span style="font-family: Monaco; font-size: 10px;"> // expected-note {{use __bridge to convert directly (no change in ownership)}} \</span><br style="font-family: Monaco; font-size: 10px;"><span style="font-family: Monaco; font-size: 10px;">+                 // expected-note {{use __bridge_transfer to transfer ownership of a +1 'CGColorRef' (aka 'struct CGColor *') into ARC}}</span><br style="font-family: Monaco; font-size: 10px;"></blockquote><div><br></div><div>QoI: We really only need the first error, and that should have a fix-it that inserts the method call, and then from then on we compile as if the user had inserted it. (But since it's an error, we won't get past -fsyntax-only anyway, which is correct.)</div><div><br></div><div><br></div></div></blockquote></div><br></div></div></body></html>