Bug 171041

Summary: We incorrectly throw a syntax error when declaring a top level for-loop iteration variable the same as a parameter
Product: WebKit Reporter: Rob Stutton <rob>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, ashwinkumar9944, benjamin, buildbot, cherrylzapantaujl75, ciro.cristhian, commit-queue, ege96ily53, fpizlo, ggaren, gskachkov, jfbastien, jimmycrosby45, joepeck, keith_miller, lasalep928, mark.lam, michaeljordanz1108, msaboff, pkoszulinski, quoteswithinspiration, saam, solya9a, ticaiolima, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: macOS 10.12   
Attachments:
Description Flags
patch
none
patch none

Rob Stutton
Reported 2017-04-19 22:17:54 PDT
I wouldn't write code like this (below) myself, but it was emitted by the minifier and so my app doesn't work in Safari, or Safari TP. The code looks legal to me ... let e = e => { console.log(e); for (let e of [1, 2, 3]) // Cannot declare a let variable twice: 'e'. console.log(e); };
Attachments
patch (11.09 KB, patch)
2017-05-21 15:10 PDT, Saam Barati
no flags
patch (11.09 KB, patch)
2017-05-21 15:19 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2017-04-21 15:04:24 PDT
(In reply to Rob Stutton from comment #0) > I wouldn't write code like this (below) myself, but it was emitted by the > minifier and so my app doesn't work in Safari, or Safari TP. > The code looks legal to me ... > > let e = e => { > console.log(e); > for (let e of [1, 2, 3]) // Cannot declare a let variable twice: 'e'. > console.log(e); > }; Yeah this looks like it should not be a syntax error, however, I think this should be: ``` let x = (e) => { let e; } ``` I bet the code that ensures that the above is a syntax error is kicking in when it shouldn't be.
Radar WebKit Bug Importer
Comment 2 2017-05-09 12:15:22 PDT
Saam Barati
Comment 3 2017-05-21 15:10:04 PDT
Build Bot
Comment 4 2017-05-21 15:13:02 PDT
Attachment 310818 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/ChangeLog:13: Line contains tab character. [whitespace/tab] [5] ERROR: Source/JavaScriptCore/ChangeLog:20: Line contains tab character. [whitespace/tab] [5] Total errors found: 2 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 5 2017-05-21 15:19:51 PDT
Yusuke Suzuki
Comment 6 2017-05-21 22:04:44 PDT
Comment on attachment 310819 [details] patch r=me
WebKit Commit Bot
Comment 7 2017-05-21 22:47:36 PDT
Comment on attachment 310819 [details] patch Clearing flags on attachment: 310819 Committed r217200: <http://trac.webkit.org/changeset/217200>
WebKit Commit Bot
Comment 8 2017-05-21 22:47:38 PDT
All reviewed patches have been landed. Closing bug.
Piotrek KoszuliƄski (Reinmar)
Comment 9 2017-09-05 02:18:01 PDT
How can this patch be not released yet (in a stable channel)? Since May? It will cause most of apps written in minified ES6 to fail.
Note You need to log in before you can comment on or make changes to this bug.