Fixed an issue causing spurious "used before being assigned" errors in for of/in loops - #61376
Conversation
…n for of/in loops
|
TypeScript Bot (@typescript-bot) test this |
|
TypeScript Bot (@typescript-bot) test it |
Ryan Cavanaugh (RyanCavanaugh)
left a comment
There was a problem hiding this comment.
I'm not 100.000% convinced that there's always a .parent.parent but it seems like this would have crashed a test if that weren't the case. Running RWC suite just to be sure
|
TypeScript Bot (@typescript-bot) test it |
|
Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready. Everything looks the same! |
|
Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
Port of microsoft/TypeScript#61376. Adds check for isForInOrOfStatement to prevent false positive TS2454 errors for variables declared in for-in/for-of loops when referenced in closures within the loop body. Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
…n for of/in loops (microsoft#61376) Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com>
Added test from upstream PR microsoft/TypeScript#61376 to verify the fix for spurious "used before being assigned" errors (TS2454) in for-in/of loops. Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
fixes #61375