{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/8839","repository_url":"https://api.github.com/repos/babel/babel","labels_url":"https://api.github.com/repos/babel/babel/issues/8839/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/8839/comments","events_url":"https://api.github.com/repos/babel/babel/issues/8839/events","html_url":"https://github.com/babel/babel/issues/8839","id":368937088,"node_id":"MDU6SXNzdWUzNjg5MzcwODg=","number":8839,"title":"Wrong behaviour in \"for...of\" statement","user":{"login":"macabeus","id":9501115,"node_id":"MDQ6VXNlcjk1MDExMTU=","avatar_url":"https://avatars1.githubusercontent.com/u/9501115?v=4","gravatar_id":"","url":"https://api.github.com/users/macabeus","html_url":"https://github.com/macabeus","followers_url":"https://api.github.com/users/macabeus/followers","following_url":"https://api.github.com/users/macabeus/following{/other_user}","gists_url":"https://api.github.com/users/macabeus/gists{/gist_id}","starred_url":"https://api.github.com/users/macabeus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macabeus/subscriptions","organizations_url":"https://api.github.com/users/macabeus/orgs","repos_url":"https://api.github.com/users/macabeus/repos","events_url":"https://api.github.com/users/macabeus/events{/privacy}","received_events_url":"https://api.github.com/users/macabeus/received_events","type":"User","site_admin":false},"labels":[{"id":440210152,"node_id":"MDU6TGFiZWw0NDAyMTAxNTI=","url":"https://api.github.com/repos/babel/babel/labels/i:%20bug","name":"i: bug","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-11T03:23:32Z","updated_at":"2018-10-11T11:45:37Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Bug Report\r\n\r\n**Current Behavior**\r\nThrows this exception:\r\n```\r\nTypeError: undefined: Duplicate declaration \"i\"\r\n  1 | \r\n  2 | for (let i of 'foo') {\r\n> 3 |   let i = 'a';\r\n    |       ^\r\n  4 |   console.log(i);\r\n  5 | }\r\n  6 | \r\n```\r\n\r\n**Input Code**\r\n```js\r\nfor (let i of 'foo') {\r\n  let i = 'a';\r\n  console.log(i);\r\n}\r\n```\r\n\r\n**Expected behavior/code**\r\nShould prints `'a'` three times instead of throws this exception.\r\nThis is the behaviour in Node and Safari, for example.\r\n\r\n**Babel Configuration (CLI command)**\r\n\r\n```js\r\nconst output = require('@babel/core').transform(`\r\nfor (let i of 'foo') {\r\n  let i = 'a';\r\n  console.log(i);\r\n}\r\n`, {\r\n  presets: ['@babel/preset-env']\r\n});\r\n```\r\n\r\n**Environment**\r\n- Babel version(s): lastest\r\n- Node/npm version: Node 9\r\n- OS: macOS High Sierra\r\n- Monorepo: yes\r\n- How you are using Babel: `cli`"},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/428924859","html_url":"https://github.com/babel/babel/issues/8839#issuecomment-428924859","issue_url":"https://api.github.com/repos/babel/babel/issues/8839","id":428924859,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODkyNDg1OQ==","user":{"login":"macabeus","id":9501115,"node_id":"MDQ6VXNlcjk1MDExMTU=","avatar_url":"https://avatars1.githubusercontent.com/u/9501115?v=4","gravatar_id":"","url":"https://api.github.com/users/macabeus","html_url":"https://github.com/macabeus","followers_url":"https://api.github.com/users/macabeus/followers","following_url":"https://api.github.com/users/macabeus/following{/other_user}","gists_url":"https://api.github.com/users/macabeus/gists{/gist_id}","starred_url":"https://api.github.com/users/macabeus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macabeus/subscriptions","organizations_url":"https://api.github.com/users/macabeus/orgs","repos_url":"https://api.github.com/users/macabeus/repos","events_url":"https://api.github.com/users/macabeus/events{/privacy}","received_events_url":"https://api.github.com/users/macabeus/received_events","type":"User","site_admin":false},"created_at":"2018-10-11T11:45:37Z","updated_at":"2018-10-11T11:45:37Z","author_association":"CONTRIBUTOR","body":"@nicolo-ribaudo Yeah, I found this new bug when I was trying to resolve this another issue, but I could not resolve 😞\r\n\r\nDo you have any idea how to resolve it? I'm not sure, but I think that this bug happens because [this line](https://github.com/babel/babel/blob/6b8261bbb7ebb8d2980cb30c3b3369678fd99835/packages/babel-plugin-transform-block-scoping/src/index.js#L736 ) not to extend correctly when it have two variables with the same name, or because [this function](https://github.com/babel/babel/blob/6b8261bbb7ebb8d2980cb30c3b3369678fd99835/packages/babel-plugin-transform-block-scoping/src/index.js#L691) should also to add declarations at `node.init` if the node is a `ForStatement` and make more changes at function `updateScopeInfo`."}}
{"actor":{"display_login":"macabeus"}}