{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/4869","repository_url":"https://api.github.com/repos/apple/swift","labels_url":"https://api.github.com/repos/apple/swift/issues/4869/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/4869/comments","events_url":"https://api.github.com/repos/apple/swift/issues/4869/events","html_url":"https://github.com/apple/swift/pull/4869","id":177902121,"number":4869,"title":"(take 2) SR-0140: Bridge Optionals to nonnull ObjC objects by bridging their payload, or using a sentinel.","user":{"login":"jckarter","id":147281,"avatar_url":"https://avatars.githubusercontent.com/u/147281?v=3","gravatar_id":"","url":"https://api.github.com/users/jckarter","html_url":"https://github.com/jckarter","followers_url":"https://api.github.com/users/jckarter/followers","following_url":"https://api.github.com/users/jckarter/following{/other_user}","gists_url":"https://api.github.com/users/jckarter/gists{/gist_id}","starred_url":"https://api.github.com/users/jckarter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jckarter/subscriptions","organizations_url":"https://api.github.com/users/jckarter/orgs","repos_url":"https://api.github.com/users/jckarter/repos","events_url":"https://api.github.com/users/jckarter/events{/privacy}","received_events_url":"https://api.github.com/users/jckarter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-19T21:24:39Z","updated_at":"2016-09-20T01:06:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/4869","html_url":"https://github.com/apple/swift/pull/4869","diff_url":"https://github.com/apple/swift/pull/4869.diff","patch_url":"https://github.com/apple/swift/pull/4869.patch"},"body":"id-as-Any lets you pass Optional to an ObjC API that takes `nonnull id`, and also lets you bridge containers of `Optional` to `NSArray` etc. When this occurs, we can unwrap the value and bridge it so that inhabited optionals still pass into ObjC in the expected way, but we need something to represent `none` other than the `nil` pointer. Cocoa provides `NSNull` as the canonical \"null for containers\" object, which is the least bad of many possible answers. If we happen to have the rare nested optional `T??`, there is no precedented analog for these in Cocoa, so just generate a unique sentinel object to preserve the `nil`-ness depth so we at least don't lose information round-tripping across the ObjC-Swift bridge.\r\n\r\nMaking Optional conform to _ObjectiveCBridgeable is more or less enough to make this all work, though there are a few additional edge case things that need to be fixed up. We don't want to accept `AnyObject??` as an @objc-compatible type, so special-case Optional in `getForeignRepresentable`.\r\n\r\nImplements SR-0140 (rdar://problem/27905315)."},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/248173525","html_url":"https://github.com/apple/swift/pull/4869#issuecomment-248173525","issue_url":"https://api.github.com/repos/apple/swift/issues/4869","id":248173525,"user":{"login":"jrose-apple","id":15097531,"avatar_url":"https://avatars.githubusercontent.com/u/15097531?v=3","gravatar_id":"","url":"https://api.github.com/users/jrose-apple","html_url":"https://github.com/jrose-apple","followers_url":"https://api.github.com/users/jrose-apple/followers","following_url":"https://api.github.com/users/jrose-apple/following{/other_user}","gists_url":"https://api.github.com/users/jrose-apple/gists{/gist_id}","starred_url":"https://api.github.com/users/jrose-apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrose-apple/subscriptions","organizations_url":"https://api.github.com/users/jrose-apple/orgs","repos_url":"https://api.github.com/users/jrose-apple/repos","events_url":"https://api.github.com/users/jrose-apple/events{/privacy}","received_events_url":"https://api.github.com/users/jrose-apple/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T01:06:13Z","updated_at":"2016-09-20T01:06:13Z","body":"Some comments made, but mostly seems fine to me…except that someone else should take a look at the lib/SIL/ changes."}}
{"actor":{"display_login":"jrose-apple"}}