{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift-protobuf/issues/785","repository_url":"https://api.github.com/repos/apple/swift-protobuf","labels_url":"https://api.github.com/repos/apple/swift-protobuf/issues/785/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift-protobuf/issues/785/comments","events_url":"https://api.github.com/repos/apple/swift-protobuf/issues/785/events","html_url":"https://github.com/apple/swift-protobuf/pull/785","id":350553627,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4Mzc2MDcw","number":785,"title":"Fix clearX() methods mutating the underlying storage instead of uniquing","user":{"login":"zwaldowski","id":170812,"node_id":"MDQ6VXNlcjE3MDgxMg==","avatar_url":"https://avatars2.githubusercontent.com/u/170812?v=4","gravatar_id":"","url":"https://api.github.com/users/zwaldowski","html_url":"https://github.com/zwaldowski","followers_url":"https://api.github.com/users/zwaldowski/followers","following_url":"https://api.github.com/users/zwaldowski/following{/other_user}","gists_url":"https://api.github.com/users/zwaldowski/gists{/gist_id}","starred_url":"https://api.github.com/users/zwaldowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zwaldowski/subscriptions","organizations_url":"https://api.github.com/users/zwaldowski/orgs","repos_url":"https://api.github.com/users/zwaldowski/repos","events_url":"https://api.github.com/users/zwaldowski/events{/privacy}","received_events_url":"https://api.github.com/users/zwaldowski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"thomasvl","id":5279928,"node_id":"MDQ6VXNlcjUyNzk5Mjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5279928?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasvl","html_url":"https://github.com/thomasvl","followers_url":"https://api.github.com/users/thomasvl/followers","following_url":"https://api.github.com/users/thomasvl/following{/other_user}","gists_url":"https://api.github.com/users/thomasvl/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasvl/subscriptions","organizations_url":"https://api.github.com/users/thomasvl/orgs","repos_url":"https://api.github.com/users/thomasvl/repos","events_url":"https://api.github.com/users/thomasvl/events{/privacy}","received_events_url":"https://api.github.com/users/thomasvl/received_events","type":"User","site_admin":false},"assignees":[{"login":"thomasvl","id":5279928,"node_id":"MDQ6VXNlcjUyNzk5Mjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5279928?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasvl","html_url":"https://github.com/thomasvl","followers_url":"https://api.github.com/users/thomasvl/followers","following_url":"https://api.github.com/users/thomasvl/following{/other_user}","gists_url":"https://api.github.com/users/thomasvl/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasvl/subscriptions","organizations_url":"https://api.github.com/users/thomasvl/orgs","repos_url":"https://api.github.com/users/thomasvl/repos","events_url":"https://api.github.com/users/thomasvl/events{/privacy}","received_events_url":"https://api.github.com/users/thomasvl/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2018-08-14T18:50:24Z","updated_at":"2018-08-14T20:26:30Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apple/swift-protobuf/pulls/785","html_url":"https://github.com/apple/swift-protobuf/pull/785","diff_url":"https://github.com/apple/swift-protobuf/pull/785.diff","patch_url":"https://github.com/apple/swift-protobuf/pull/785.patch"},"body":"The generated `clearX()` methods do not correctly COW unique the underlying storage for heap-backed types.\r\n\r\nConsider:\r\n\r\n```\r\nvar model1: MyProto\r\nmodel1.nestedMessage = …\r\nprint(1, model1.nestedMessage)\r\n\r\nvar model2 = model1\r\nmodel2.clearNestedMessage()\r\nprint(model1.nestedMessage)\r\nprint(model2.nestedMessage)\r\n```\r\n\r\nBefore:\r\n\r\n```\r\n1, Module.MyProto.NestedMessage:\r\na: \"a\"\r\nb: \"b\"\r\nc: \"c\"\r\n\r\n2, Module.MyProto.NestedMessage:\r\n\r\n3, Module.MyProto.NestedMessage:\r\n\r\n ```\r\n\r\nAfter:\r\n\r\n```\r\n1, Module.MyProto.NestedMessage:\r\na: \"a\"\r\nb: \"b\"\r\nc: \"c\"\r\n\r\n2, Module.MyProto.NestedMessage:\r\na: \"a\"\r\nb: \"b\"\r\nc: \"c\"\r\n\r\n3, Module.MyProto.NestedMessage:\r\n\r\n ```"},"comment":{"url":"https://api.github.com/repos/apple/swift-protobuf/issues/comments/413004361","html_url":"https://github.com/apple/swift-protobuf/pull/785#issuecomment-413004361","issue_url":"https://api.github.com/repos/apple/swift-protobuf/issues/785","id":413004361,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzAwNDM2MQ==","user":{"login":"thomasvl","id":5279928,"node_id":"MDQ6VXNlcjUyNzk5Mjg=","avatar_url":"https://avatars3.githubusercontent.com/u/5279928?v=4","gravatar_id":"","url":"https://api.github.com/users/thomasvl","html_url":"https://github.com/thomasvl","followers_url":"https://api.github.com/users/thomasvl/followers","following_url":"https://api.github.com/users/thomasvl/following{/other_user}","gists_url":"https://api.github.com/users/thomasvl/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasvl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasvl/subscriptions","organizations_url":"https://api.github.com/users/thomasvl/orgs","repos_url":"https://api.github.com/users/thomasvl/repos","events_url":"https://api.github.com/users/thomasvl/events{/privacy}","received_events_url":"https://api.github.com/users/thomasvl/received_events","type":"User","site_admin":false},"created_at":"2018-08-14T20:26:30Z","updated_at":"2018-08-14T20:26:30Z","author_association":"COLLABORATOR","body":"#786 up for the tests to round this out."}}
{"actor":{"display_login":"thomasvl"}}