Test code: let callback1; let callbacks2 = new Array(); let callbacks3 = new Array(); for ( let i = (callback1 = () => i, 0); callbacks2.push(() => i), i < 5; callbacks3.push(() => i), i++) { // loop body i++; } console.log(callback1()); console.log(callbacks2[0]()); console.log(callbacks3[0]()); Expected output (works in Chrome and Firefox) 0 1 3 Actual output in Safari TP 65: 1 1 3 Note: I found this test code at: https://github.com/Microsoft/TypeScript/issues/17632
<rdar://problem/44730906>
Thanks for the report. It looks like Chrome and Firefox are correct w.r.t the spec: https://tc39.github.io/ecma262/#sec-for-statement-runtime-semantics-labelledevaluation
Just marking this as "covered" in Test262. https://github.com/tc39/test262/blob/master/test/language/statements/for/scope-body-lex-open.js
I'm not sure when this was fixed, but I'm unable to repro in Safari 15.3.
Sorry for the noise, this is still broken in Safari 15.3 and Safari TP 139.
This is still broken in Safari TP 177.
*** Bug 257677 has been marked as a duplicate of this bug. ***
Pull request: https://github.com/WebKit/WebKit/pull/19403
Committed 269653@main (f32cd0f7cb79): <https://commits.webkit.org/269653@main> Reviewed commits have been landed. Closing PR #19403 and removing active labels.