{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/530","labels_url":"https://api.github.com/repos/apple/swift/issues/530/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/530/comments","events_url":"https://api.github.com/repos/apple/swift/issues/530/events","html_url":"https://github.com/apple/swift/pull/530","id":121973792,"number":530,"title":"[WIP][SR-164] Handle ImplicitlyUnwrappedOptionals specially in IsExpr.","user":{"login":"gregomni","id":15795449,"avatar_url":"https://avatars.githubusercontent.com/u/15795449?v=3","gravatar_id":"","url":"https://api.github.com/users/gregomni","html_url":"https://github.com/gregomni","followers_url":"https://api.github.com/users/gregomni/followers","following_url":"https://api.github.com/users/gregomni/following{/other_user}","gists_url":"https://api.github.com/users/gregomni/gists{/gist_id}","starred_url":"https://api.github.com/users/gregomni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregomni/subscriptions","organizations_url":"https://api.github.com/users/gregomni/orgs","repos_url":"https://api.github.com/users/gregomni/repos","events_url":"https://api.github.com/users/gregomni/events{/privacy}","received_events_url":"https://api.github.com/users/gregomni/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-14T04:43:06Z","updated_at":"2015-12-17T18:27:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/530","html_url":"https://github.com/apple/swift/pull/530","diff_url":"https://github.com/apple/swift/pull/530.diff","patch_url":"https://github.com/apple/swift/pull/530.patch"},"body":"An IUO needs to be treated like an Optional in “is” (e.g.\r\ntest/Interpreter/SDK/objc_cast.swift:232), but an IUO is unwrapped and\r\ntreated as the underlying type in “as?”. So when converting an IsExpr\r\nto a ConditionalCheckedCastExpr, we need to inject an IUO into a ‘real’\r\nOptional."},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/165538724","html_url":"https://github.com/apple/swift/pull/530#issuecomment-165538724","issue_url":"https://api.github.com/repos/apple/swift/issues/530","id":165538724,"user":{"login":"gregomni","id":15795449,"avatar_url":"https://avatars.githubusercontent.com/u/15795449?v=3","gravatar_id":"","url":"https://api.github.com/users/gregomni","html_url":"https://github.com/gregomni","followers_url":"https://api.github.com/users/gregomni/followers","following_url":"https://api.github.com/users/gregomni/following{/other_user}","gists_url":"https://api.github.com/users/gregomni/gists{/gist_id}","starred_url":"https://api.github.com/users/gregomni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregomni/subscriptions","organizations_url":"https://api.github.com/users/gregomni/orgs","repos_url":"https://api.github.com/users/gregomni/repos","events_url":"https://api.github.com/users/gregomni/events{/privacy}","received_events_url":"https://api.github.com/users/gregomni/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T18:27:22Z","updated_at":"2015-12-17T18:27:22Z","body":"There are some extra wrinkles here - I didn't realize that \"as?\" is differently broken for the same types of expressions, so this fix is likely wrong and something else needs to happen deeper down. I'll look some more.\r\n\r\nThe bug is specifically with 'ImplicitlyUnwrappedOptional<T> is/as? SomeProtocol' where IUO itself conforms to that protocol (e.g. CustomStringConvertible in the stdlib). \"is\" asserts in the compiler and crashes, and \"as?\" hangs in the compiler. Both of these, I think, are symptoms of inconsistent auto-unwrapping. The type system warns that the expression is always true, but then later implicitly unwraps, and doesn't actually \"know\" that any more. "}}