<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=""><div class="">You’ll need to explicitly add the “as NSNumber” now.</div><div class=""><br class=""></div><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0072-eliminate-implicit-bridging-conversions.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0072-eliminate-implicit-bridging-conversions.md</a><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 9, 2016, at 1:55 PM, Rick Mann via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I've seen old (pre-Swift 3) posts online (e.g. <a href="http://stackoverflow.com/questions/28920232/why-do-integers-not-conform-to-the-anyobject-protocol" class="">http://stackoverflow.com/questions/28920232/why-do-integers-not-conform-to-the-anyobject-protocol</a>) that address this, but my code worked yesterday before I used Xcode 8 GM to migrate it to Swift 3, and now it doesn't, so I'm trying to understand what's going on.<br class=""><br class="">In this case, I have this code:<br class=""><br class="">open class HttpServer<br class="">{<br class=""> &nbsp;&nbsp;&nbsp;let clientSocketsLock = 0<br class=""><br class=""> &nbsp;&nbsp;&nbsp;open func start()<br class=""> &nbsp;&nbsp;&nbsp;{<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...some stuff...<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HttpServer.lock(self.clientSocketsLock) // &nbsp;ERROR HERE<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.clientSockets.remove(socket)<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class=""> &nbsp;&nbsp;&nbsp;}<br class=""><br class=""> &nbsp;&nbsp;&nbsp;open class func lock(_ handle: AnyObject, closure: () -&gt; ())<br class=""> &nbsp;&nbsp;&nbsp;{<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objc_sync_enter(handle)<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;closure()<br class=""> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;objc_sync_exit(handle)<br class=""> &nbsp;&nbsp;&nbsp;}<br class="">}<br class=""><br class="">I get the error "Argument type 'Int' does not conform to expected type 'AnyObject'" at the line marked above. What has changed here? &nbsp;Did Int's behavior change? Is that described somewhere? I tried googling "Swift 3 Int" and variations without much luck.<br class=""><br class="">I did see one discussion that talked about how when passing an Int to AnyObject, it was implicitly converted to NSNumber, and that this behavior only applied to certain types (e.g. not Int32). How can I tell when this kind of behavior exists? Is there a way to look at the type's declaration to see (e.g. it conforms to a protocol, or has a compiler attribute, or something)?<br class=""><br class="">Thanks,<br class=""><br class="">-- <br class="">Rick Mann<br class=""><a href="mailto:rmann@latencyzero.com" class="">rmann@latencyzero.com</a><br class=""><br class=""><br class="">_______________________________________________<br class="">swift-users mailing list<br class="">swift-users@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></div></blockquote></div><br class=""></div></body></html>