[P2] Compiler: Array.prototype.flat reads arguments indices before evaluating depth
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #3510 @nickna による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp, typescript
- 領域
- compilers
調査の方向性
Start by reading the inline Array.prototype.flat dispatch and the mapped arguments changes in #3510; compare their evaluation order with JavaScript’s call argument evaluation. Compile the sample as an unchecked classic .js program using --no-tsconfig --noLib --verify and check the trace against Node v22.23.2. Done means the depth expression runs before indexed access, while the result remains 7.
索引モデルが issue の本文から書いたものです。
説明
An indexed arguments accessor runs before the depth expression when compiled JavaScript invokes Array.prototype.flat.call. JavaScript evaluates the call arguments before entering the builtin.
function run(first) {
const args = arguments;
const trace = [];
Object.defineProperty(args, "0", { get() { trace.push("index"); return 7; } });
const result = Array.prototype.flat.call(args, (trace.push("depth expression"), 1));
console.log(result.join(","), trace.join(","));
}
run(1);
Node v22.23.2 prints 7 depth expression,index. The compiler with the mapped arguments changes in #3510 prints 7 index,depth expression and passes full saved IL verification. Clean main at cabb41636 prints an empty result with depth expression, since the former arguments snapshot skipped indexed accessors entirely. Compile the sample as an unchecked classic .js program with --no-tsconfig --noLib --verify.
Inline flat prepares its array-like input before evaluating the depth expression. The mapped arguments work makes indexed accessors observable, which exposes this pre-existing dispatch order. Related to #3533, which covers duplicate length reads.
- 主要言語
- C#
- スター
- 156
- フォーク
- 4
- 平均マージ
- 15時間 35分
- マージ済み PR(30日)
- 43
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nickna/SharpTS のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
メンテナーはふだん 1 日以内に返信
-
Compiled strict async function declarations lack the throwing callee accessor対応中かも @nickna が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 69/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dotnet/wpf#12108 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
:watch: Not Triaged dotnet/svc
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
area:build type:chore
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
csharp good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
python triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/semantic-kernel#14753 ·
メンテナーはふだん 5 日以内に返信