-
Notifications
You must be signed in to change notification settings - Fork 0
Staging tests conflict with main suite: AnnexB arguments hoisting #36
Description
Summary
Two staging tests have expectations that contradict a main suite test regarding AnnexB hoisting of block-scoped functions named arguments. The spec-correct behavior (main suite) was implemented, causing 2 staging regressions.
Spec behavior (§B.3.3.1)
Step 22.f of FunctionDeclarationInstantiation appends "arguments" to parameterNames when argumentsObjectNeeded is true. The AnnexB hoisting condition (step ii) skips hoisting when F is an element of parameterNames. Therefore, a block-scoped function arguments() {} should not be hoisted to the function scope via AnnexB when an arguments object exists.
Tests involved
Main suite (now passing):
annexB/language/function-code/block-decl-func-skip-arguments.js— expectsargumentsto remain as the arguments object after the block (no AnnexB hoisting)
Staging (now failing):
staging/sm/lexical-environment/block-scoped-functions-annex-b-arguments.js— expectstypeof argumentsto be"function"after the block (AnnexB hoisting occurs)staging/sm/regress/regress-602621.js— same expectation
Engine behavior
Node.js v18 (V8) currently hoists arguments via AnnexB, matching the staging tests. The main suite test was written for a spec compliance change that no major engine has implemented yet. The staging tests reflect the current (pre-fix) engine behavior.
Decision
Main suite takes priority over staging. The spec-correct fix was applied (+1 main pass, -2 staging). The staging tests will likely be updated once engines implement the spec change.