microsoft / microsoft/TypeScript
Automatic Brace Insertion (ABI) is undesirable
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TypeScript Version: 3.7-beta
Search Terms: automatic brace insertion ABI syntax error
Code:
function a() {
"Automatic Brace Insertion! (ABI)";
Expected behavior:
The input is syntactically invalid, so emit should fail regardless of the state of noEmitOnError. Other forms of un-parsable input already do this, e.g. function a(
Actual behavior:
A closing brace is inserted in the emitted JS code.
function a() {
"Automatic Brace Insertion! (ABI)";
}
This means that users who are not using noEmitOnError are silently having invalid code transformed into valid code. I can confirm this actually happened to someone shipping something to production.
Playground Link: ABI Playground Link
Related Issues: https://github.com/microsoft/TypeScript/issues/34870 , https://github.com/microsoft/TypeScript/issues/34871 , Lazy Twitter report
I would suggest this bug deserves to be fixed based on Design Goal 7 (Preserve runtime behavior of all JavaScript code) and Design Non-Goal 7 (Introduce behaviour that is likely to surprise users).
Tagline: If the braces don't fit, you must not emit.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ABI Playground Link と issue に示されている最小限の TypeScript 入力から始め、リンクされている未終了の関数の例とその emit の動作を比較します。この不正な形式の入力をコンパイラーがどのように処理するかを追跡し、emit が閉じ中かっこを追加せず、実行可能な JavaScript を生成しないことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100