{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/7202","repository_url":"https://api.github.com/repos/apple/swift","labels_url":"https://api.github.com/repos/apple/swift/issues/7202/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/7202/comments","events_url":"https://api.github.com/repos/apple/swift/issues/7202/events","html_url":"https://github.com/apple/swift/pull/7202","id":204795376,"number":7202,"title":"[Parse] Reject trailing closures on literals","user":{"login":"jtbandes","id":14237,"avatar_url":"https://avatars.githubusercontent.com/u/14237?v=3","gravatar_id":"","url":"https://api.github.com/users/jtbandes","html_url":"https://github.com/jtbandes","followers_url":"https://api.github.com/users/jtbandes/followers","following_url":"https://api.github.com/users/jtbandes/following{/other_user}","gists_url":"https://api.github.com/users/jtbandes/gists{/gist_id}","starred_url":"https://api.github.com/users/jtbandes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtbandes/subscriptions","organizations_url":"https://api.github.com/users/jtbandes/orgs","repos_url":"https://api.github.com/users/jtbandes/repos","events_url":"https://api.github.com/users/jtbandes/events{/privacy}","received_events_url":"https://api.github.com/users/jtbandes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-02-02T06:43:08Z","updated_at":"2017-02-02T18:29:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/7202","html_url":"https://github.com/apple/swift/pull/7202","diff_url":"https://github.com/apple/swift/pull/7202.diff","patch_url":"https://github.com/apple/swift/pull/7202.patch"},"body":"`1 { }` was parsed as a call expression with a trailing closure. This made the diagnostics for `var x = 1 { get { ... } }` extremely bad. I believe this should never be allowed for literals, and refusing to parse it as a trailing closure allows much better diagnostics to kick in:\r\n\r\n#### Before\r\n```\r\nerror: use of unresolved identifier 'get'\r\nvar x: Int? = nil { get { return 2 } }\r\n                    ^~~\r\n```\r\n#### After\r\n```\r\nerror: variable with getter/setter cannot have an initial value\r\nvar x: Int? = nil { get { return 2 } }\r\n    ^         ^~~\r\n```\r\n<!-- If this pull request resolves any bugs in the Swift bug tracker, provide a link: -->\r\nResolves [SR-3671](https://bugs.swift.org/browse/SR-3671), at least for cases where the initial value is a literal."},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/277041029","html_url":"https://github.com/apple/swift/pull/7202#issuecomment-277041029","issue_url":"https://api.github.com/repos/apple/swift/issues/7202","id":277041029,"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":"2017-02-02T18:29:25Z","updated_at":"2017-02-02T18:29:25Z","body":"I think it's okay. The process is supposed to be that the code owner makes sure everything in their component *gets* reviewed by someone they trust, not that it's been reviewed by *them* specifically. And they can always comment post-merge, and as code owner have the power to revert if they disagree. Between me and @rintaro I think you've gotten sufficient review."}}
{"actor":{"display_login":"jrose-apple"}}