Top-level await reparse keeps statements it already consumed when it reaches the end of the file
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- go, typescript
- 領域
- compilers
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
🔎 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).
- 主要言語
- Go
- スター
- 112k
- フォーク
- 16k
- 平均マージ
- 3日 6時間
- マージ済み PR(30日)
- 136
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript のほかの issue
-
API: `tsc.exe` opens a visible console window on Windows when the parent process has no consoleオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
microsoft/TypeScript#65083 ·
メンテナーはふだん 1 日以内に返信
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/TypeScript#64758 ·
メンテナーはふだん 1 日以内に返信
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`対応中かも @rajnish-verma-22172 が 11 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/TypeScript#64742 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindings対応中かも @dmety が 24 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/TypeScript#64661 ·
メンテナーはふだん 1 日以内に返信
-
Non-enum CLI options with multiple values separated by comma and space aren't whitespace trimmed対応中かも @RyanCavanaugh が 25 日前に担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/TypeScript#64618 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
microsoft/TypeScript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
[Request]: pigオープンpackage-request
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ScoopInstaller/Extras#19203 ·
メンテナーはふだん 1 日以内に返信
-
terminal: with OptionAsAlt, ⌥E types ´ after ESC e on macOS対応中かも @egoist が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
security
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Waschndolos/open-clubmanager#185 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
router-for-me/CLIProxyAPI#7161 ·
メンテナーはふだん 1 日以内に返信