test: 改 rest 形解构赋值回归钉初值为零修复判别力

This commit is contained in:
2026-10-06 04:14:53 +00:00
parent 77f6ea52c3
commit 7ab8a0587d
3 changed files with 20 additions and 20 deletions
@@ -322,7 +322,7 @@ fn captured_top_let_destructuring_default_assign() {
fn captured_top_let_rest_destructuring_assign() {
// rest 元素须为末位,标识符目标在 rest 前:写落 cell 的判别与主形同。
assert_eq!(
eval("let x = 1; function f() { return x; } [x, ...r] = [1, 2]; f() === 1 && x === 1"),
eval("let x = 0; function f() { return x; } [x, ...r] = [1, 2]; f() === 1 && x === 1"),
"true",
"rest destructuring assignment to a captured top-level let updates the cell"
);