{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/test262/issues/524","repository_url":"https://api.github.com/repos/tc39/test262","labels_url":"https://api.github.com/repos/tc39/test262/issues/524/labels{/name}","comments_url":"https://api.github.com/repos/tc39/test262/issues/524/comments","events_url":"https://api.github.com/repos/tc39/test262/issues/524/events","html_url":"https://github.com/tc39/test262/pull/524","id":137382461,"number":524,"title":"Add tests for IteratorClose in dstr assignment","user":{"login":"jugglinmike","id":677252,"avatar_url":"https://avatars.githubusercontent.com/u/677252?v=3","gravatar_id":"","url":"https://api.github.com/users/jugglinmike","html_url":"https://github.com/jugglinmike","followers_url":"https://api.github.com/users/jugglinmike/followers","following_url":"https://api.github.com/users/jugglinmike/following{/other_user}","gists_url":"https://api.github.com/users/jugglinmike/gists{/gist_id}","starred_url":"https://api.github.com/users/jugglinmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jugglinmike/subscriptions","organizations_url":"https://api.github.com/users/jugglinmike/orgs","repos_url":"https://api.github.com/users/jugglinmike/repos","events_url":"https://api.github.com/users/jugglinmike/events{/privacy}","received_events_url":"https://api.github.com/users/jugglinmike/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-29T21:31:01Z","updated_at":"2016-03-01T19:09:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tc39/test262/pulls/524","html_url":"https://github.com/tc39/test262/pull/524","diff_url":"https://github.com/tc39/test262/pull/524.diff","patch_url":"https://github.com/tc39/test262/pull/524.patch"},"body":"@littledan recently discovered a hole in Test262's coverage of destructuring assignment: no tests exist to assert the use of the IteratorClose interal operation in [DestructuringAssignmentEvaluation](http://www.ecma-international.org/ecma-262/6.0/#sec-runtime-semantics-destructuringassignmentevaluation).\r\n\r\nI've tried address all the missing cases in this patch. To assist review, here's the naming scheme:\r\n\r\nPrefix             | Grammar production\r\n-------------------|-------------------\r\n`array-empty-`     | ArrayAssignmentPattern : [ ]\r\n`array-elision-`   | ArrayAssignmentPattern : [ Elision ]\r\n`array-rest-`      | ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]\r\n`array-elem-`      | ArrayAssignmentPattern : [ AssignmentElementList ]\r\n`array-elem-trlg-` | ArrayAssignmentPattern : [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]\r\n\r\nSuffix             | Intent\r\n-------------------|-------\r\n`-abpt-close-err`  | The assignment evaluation returns an abrupt completion, and the iterator's `return` method throws an error\r\n`-abpt-close-skip` | The assignment evaluation returns an abrupt completion, but IteratorClose is not invoked\r\n`-abpt-close`      | The assignment evaluation returns an abrupt completion, and IteratorClose is invoked as specified\r\n`-get-err`         | Abrupt completion returned from GetIterator\r\n`-nrml-close-err`  | The assignment evaluation completes, and the iterator's `return` method throws an error\r\n`-nrml-close-null` | The assignment evaluation completes, and the iterator's `return` method returns a non-Object value (there is no corresponding `-abpt-` suffix because the algorithm does not reference the return value in those cases)\r\n`-nrml-close-skip` | The assignment evaluation completes, but IteratorClose is not invoked\r\n`-nrml-close`      | The assignment evaluation completes, and IteratorClose is invoked as specified\r\n\r\nNot every production uses all of the suffixes; I simplified the file name where the specificity was not necessary (e.g. `array-elision-iter-abpt.js`)."},"comment":{"url":"https://api.github.com/repos/tc39/test262/issues/comments/190855874","html_url":"https://github.com/tc39/test262/pull/524#issuecomment-190855874","issue_url":"https://api.github.com/repos/tc39/test262/issues/524","id":190855874,"user":{"login":"jugglinmike","id":677252,"avatar_url":"https://avatars.githubusercontent.com/u/677252?v=3","gravatar_id":"","url":"https://api.github.com/users/jugglinmike","html_url":"https://github.com/jugglinmike","followers_url":"https://api.github.com/users/jugglinmike/followers","following_url":"https://api.github.com/users/jugglinmike/following{/other_user}","gists_url":"https://api.github.com/users/jugglinmike/gists{/gist_id}","starred_url":"https://api.github.com/users/jugglinmike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jugglinmike/subscriptions","organizations_url":"https://api.github.com/users/jugglinmike/orgs","repos_url":"https://api.github.com/users/jugglinmike/repos","events_url":"https://api.github.com/users/jugglinmike/events{/privacy}","received_events_url":"https://api.github.com/users/jugglinmike/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T19:09:41Z","updated_at":"2016-03-01T19:09:41Z","body":"Sounds good, @anba. This warrants a change to the naming scheme. I'll rename\r\n`*-abpt-*` to `*-thrw-*` to make room for equivalent `*-rtrn-*` tests. I'm\r\ngoing to try a more direct approach in order to limit the semantics under test:\r\n\r\n```js\r\nvar iterable = {};\r\nvar returnCount = 0;\r\nvar unreachable = 0;\r\niterable[Symbol.iterator] = function() {\r\n  return {\r\n    next: function() {},\r\n    return: function() {\r\n      returnCount += 1;\r\n      return {};\r\n    }\r\n  };\r\n};\r\nfunction* g() {\r\n  [x[yield]] = iterable;\r\n  unreachable += 1;\r\n};\r\nvar it = g();\r\nit.next();\r\nit.return();\r\nassert.sameValue(returnCount, 1);\r\nassert.sameValue(unreachable, 0);\r\n```\r\n\r\nDoes that look valid to you?"}}