Skip to content

Staging tests conflict with main suite: AnnexB arguments hoisting #36

@pmatos

Description

@pmatos

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 — expects arguments to 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 — expects typeof arguments to 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions