Bug 147600

Summary: JSC allows invalid var declarations when the declared name is the same as a let/const variable
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: basile_clement, benjamin, fpizlo, ggaren, mark.lam, mmirman, msaboff, oliver, ysuzuki
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch ysuzuki: review+

Description Saam Barati 2015-08-03 16:47:17 PDT
Unfortunately, this is dependent on which variable was declared first.
This should be a syntax error but isn't:
"let NAME; var NAME;"
Comment 1 Saam Barati 2015-09-23 15:02:58 PDT
Created attachment 261842 [details]
patch
Comment 2 Yusuke Suzuki 2015-09-23 15:12:24 PDT
Comment on attachment 261842 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=261842&action=review

r=me

> LayoutTests/js/script-tests/let-syntax.js:70
> +shouldNotHaveSyntaxError("function foo() { { let x; } var x; }");

Nice!

> LayoutTests/js/script-tests/let-syntax.js:105
> +shouldHaveSyntaxError("let x; var [x] = 20;");

I suggest adding `var x; let x;` cases because this issue depended on the occurrence order.
Comment 3 Saam Barati 2015-09-23 15:38:39 PDT
landed in:
http://trac.webkit.org/changeset/190188