SyntaxError upon re-declaration
Reported by
christof...@gmail.com,
Sep 13 2016
|
||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Steps to reproduce the problem:
1.
Execute the following piece of JavaScript in Chrome.
while (true) {
function inc() {}
var inc = null;
break;
}
What is the expected behavior?
The program is syntactically correct.
What went wrong?
Uncaught SyntaxError: Identifier 'inc' has already been declared
Did this work before? N/A
Chrome version: 52.0.2743.116 Channel: n/a
OS Version: OS X 10.10.5
Flash Version: Shockwave Flash 22.0 r0
,
Sep 13 2016
,
Sep 14 2016
,
Sep 14 2016
As you've figured out, this is indeed working as intended per the ECMAScript 2015 spec. Our error message seems reasonable to me; at least, the name of the variable is pointed out. Mentioning "let" actually seems more confusing, since there's no "let" here.
,
Sep 14 2016
Even though this is banned by the current spec, I believe it used to work. However, we've been shipping the new semantics for some time. christofferqa , was this test extracted from any particular website that broke? |
||||
►
Sign in to add a comment |
||||
Comment 1 by christof...@gmail.com
, Sep 13 2016