Top-level await reparse keeps statements it already consumed when it reaches the end of the file
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- go, typescript
- Domaine
- compilers
Piste de recherche
Start with the Go parser’s reparseTopLevelAwait path and inspect how it copies original statements after reparsing advances to the end of the file. Reproduce the overlapping statement positions with the provided input and check the regression test in linked pull request #64993; done means no copied statement starts before the end of its preceding statement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
🔎 Search Terms
top-level await, reparse, reparseTopLevelAwait, overlapping statements, parse tree, sibling
🕗 Version & Regression Information
- TypeScript 7 at
main4a4b24d5dc96d148641ec6a39c4f5bbf023cbb2f (the Go parser). - TypeScript 6.0.3 also keeps overlapping statements for this input: its
ExpressionStatement [26, 28)starts before the statement before it ends at 37.
⏯ Playground Link
Not applicable: the problem is in the parse tree's node positions.
💻 Code
export {}; await + f(const 0 await !x
🙁 Actual behavior
The source file's statements are ExportDeclaration [0, 10), ExpressionStatement [10, 37) and ExpressionStatement [36, 37). The last one starts before the previous one ends: x is parsed twice, once inside the reparsed await + f(...) statement and once as a statement of its own.
In a module, reparseTopLevelAwait reparses the statements that may contain await in an await context, and a reparsed statement can read past its span. When the reparse reaches the end of the file, the original statements after the last span it advanced to are still copied into the new statement list.
🙂 Expected behavior
No statement starts before the end of the statement before it: once the reparse reaches the end of the file, no original statement is left to copy.
Additional information about the issue
Found by fuzzing the parser of a fork of this repository with a sibling-order invariant (each node starts at or after the end of its previous sibling). A fix with a regression test is in #64993.
This report was drafted with Claude Code (Claude Opus 5.5).
- Langage dominant
- Go
- Étoiles
- 112k
- Forks
- 15.4k
- Merge moyen
- 2 j 21 h
- PR mergées (30 j)
- 126
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/TypeScript
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoft/TypeScript#65087 ·
Les mainteneurs répondent en général sous 1 jour
-
API: `tsc.exe` opens a visible console window on Windows when the parent process has no consoleOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoft/TypeScript#65083 ·
Les mainteneurs répondent en général sous 1 jour
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'Peut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
microsoft/TypeScript#64758 ·
Les mainteneurs répondent en général sous 1 jour
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`Peut-être pris @rajnish-verma-22172 l’a pris il y a 12 jours. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
microsoft/TypeScript#64742 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsPeut-être pris @dmety l’a pris il y a 25 jours. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
microsoft/TypeScript#64661 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de microsoft/TypeScript
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
limitlessprojects/Go-Hybrid#3342 ·
Les mainteneurs répondent en général sous 1 jour
-
status/ready type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
buildpacks/pack#2733 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
kind/bug needs-priority needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
konveyor/tackle2-hub#1166 · 1 commentaire ·
Les mainteneurs répondent en général sous 4 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
router-for-me/CLIProxyAPI#7209 ·
Les mainteneurs répondent en général sous 1 jour