<p dir="auto">Choose one: is this a bug report or feature request?</p>

<h3 dir="auto">Input Code</h3>


<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Test {
    testFun() {
        return 0;
    }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Test</span> <span class="pl-kos">{</span>
    <span class="pl-en">testFun</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-k">return</span> <span class="pl-c1">0</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Babel Configuration (.babelrc, package.json, cli command)</h3>

<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;babel-preset-es2015&quot;: &quot;7.0.0-alpha.10&quot;,
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-s">"babel-preset-es2015"</span>: <span class="pl-s">"7.0.0-alpha.10"</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected Behavior</h3>


<p dir="auto">I used babel-preset-es2015 7.0.0-alpha.10<br>
when I compile Test.js<br>
compile error  "path.get(...).arrowFunctionToExpression is not a function while parsing"</p>
<p dir="auto">Minimal repro:</p>
<p dir="auto">.babelrc</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;presets&quot;: [&quot;es2015&quot;, &quot;stage-2&quot;]
}"><pre class="notranslate">{
  <span class="pl-ent">"presets"</span>: [<span class="pl-s"><span class="pl-pds">"</span>es2015<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>stage-2<span class="pl-pds">"</span></span>]
}</pre></div>
<p dir="auto">repro.js</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Stream {
 timeout(timeLimit, opts) {
    let timeout = null;
  }
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Stream</span> <span class="pl-kos">{</span>
 <span class="pl-en">timeout</span><span class="pl-kos">(</span><span class="pl-s1">timeLimit</span><span class="pl-kos">,</span> <span class="pl-s1">opts</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> <span class="pl-s1">timeout</span> <span class="pl-c1">=</span> <span class="pl-c1">null</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ babel --version
6.1.18 (babel-core 6.1.19)

$ babel repro.js 
TypeError: repro.js: Duplicate declaration &quot;timeout&quot;
  1 | class Stream {
  2 |  timeout(timeLimit, opts) {
&gt; 3 |     let timeout = null;
    |         ^
  4 |   }
  5 | }
  6 | 
    at File.buildCodeFrameError (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:408:15)
    at Scope.checkBlockScopedCollisions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:488:27)
    at Scope.&lt;anonymous&gt; (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:673:18)
    at Scope.registerBinding (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:687:8)
    at Scope.registerDeclaration (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:575:14)
    at Object.BlockScoped (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:226:28)
    at Object.newFn (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/visitors.js:311:17)
    at NodePath._call (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:72:18)
    at NodePath.call (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:40:14)
    at NodePath.visit (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:102:12)"><pre class="notranslate">$ babel --version
6.1.18 (babel-core 6.1.19)

$ babel repro.js 
TypeError: repro.js: Duplicate declaration <span class="pl-s"><span class="pl-pds">"</span>timeout<span class="pl-pds">"</span></span>
  1 <span class="pl-k">|</span> class Stream {
  2 <span class="pl-k">|</span>  timeout(timeLimit, opts) {
<span class="pl-k">&gt;</span> 3 <span class="pl-k">|</span>     <span class="pl-c1">let</span> timeout = null<span class="pl-k">;</span>
    <span class="pl-k">|</span>         ^
  4 <span class="pl-k">|</span>   }
  5 <span class="pl-k">|</span> }
  6 <span class="pl-k">|</span> 
    at File.buildCodeFrameError (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:408:15)
    at Scope.checkBlockScopedCollisions (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:488:27)
    at Scope.<span class="pl-k">&lt;</span>anonymous<span class="pl-k">&gt;</span> (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:673:18)
    at Scope.registerBinding (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:687:8)
    at Scope.registerDeclaration (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:575:14)
    at Object.BlockScoped (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/scope/index.js:226:28)
    at Object.newFn (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/visitors.js:311:17)
    at NodePath._call (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:72:18)
    at NodePath.call (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:40:14)
    at NodePath.visit (/usr/local/lib/node_modules/babel-cli/node_modules/babel-traverse/lib/path/context.js:102:12)</pre></div>
<p dir="auto">According to the author of the original code (which is not me), this should be allowed and it is also working in Chrome Canary.</p>
<blockquote>
<p dir="auto">As I understand it, a function has its own LexicalEnvironment and corresponding EnvironmentRecord. Creating a new binding only checks for duplicates in that same EnvironmentRecord - not in any containing LexicalEnvironment / EnvironmentRecord:</p>
<p dir="auto">[http://www.ecma-international.org/ecma-262/6.0/#sec-declarative-environment-records-createmutablebinding-n-d]</p>
</blockquote>
<p dir="auto">Also see this original <a href="https://github.com/dart-lang/dev_compiler/issues/385#issuecomment-156451540" data-hovercard-type="issue" data-hovercard-url="/dart-archive/dev_compiler/issues/385/hovercard">issue</a>.</p>