Skip to content

[JavaScript] Fix pre-mature termination of for loops in TypeScript - #4593

Merged
deathaxe merged 2 commits into
sublimehq:masterfrom
deathaxe:pr/javascript/fix-typescript-for-loop
Jul 28, 2026
Merged

[JavaScript] Fix pre-mature termination of for loops in TypeScript#4593
deathaxe merged 2 commits into
sublimehq:masterfrom
deathaxe:pr/javascript/fix-typescript-for-loop

Conversation

@deathaxe

Copy link
Copy Markdown
Collaborator

Fixes #4592

This PR makes sure expression-begin is pushed onto stack after < in both postfix-operators and ts-less-than contexts. The latter was popping before, which terminated a comparison expression too early.

Re-use JavaScript related control structure syntax tests to verify TypeScript behaving equally.

deathaxe added 2 commits July 28, 2026 09:45
This commit makes sure `expression-begin` is pushed onto stack after `<`
in both `postfix-operators` and `ts-less-than` contexts. The latter was
popping before, which terminated a comparison expression too early.

Re-use JavaScript related control structure syntax tests
to verify TypeScript behaving equally.
This commit copies syntax_test_js_control.js to verify JSX/TSX behaving equally.

@michaelblyons michaelblyons left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines of code change: 1
Lines of test change: 570 × 3
😆

@deathaxe
deathaxe merged commit 6945740 into sublimehq:master Jul 28, 2026
2 checks passed
@deathaxe
deathaxe deleted the pr/javascript/fix-typescript-for-loop branch July 28, 2026 17:08
@rchl-u

rchl-u commented Jul 29, 2026

Copy link
Copy Markdown

I haven't verified but it sounds like this also fixes:

for (let i = 0; i < argv.length; i++) {
    //
}
Screenshot 2026-07-29 at 09 45 09

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TypeScript] semicolomn in for loop condition is marked invalid

4 participants