test262 icon indicating copy to clipboard operation
test262 copied to clipboard

Add tests for "Runtime Errors for Function Call Assignment Targets"

Open rkirsling opened this issue 11 months ago • 3 comments

Add tests for normative PR https://github.com/tc39/ecma262/pull/3568, which adds Annex B section, "Runtime Errors for Function Call Assignment Targets".

Specifically:

  1. Correct the name of src/assignment-target-type/callexpression-arguments.case to callexpression.case and mark it onlyStrict.
  2. Add onlyStrict cases to language/expressions/assignmenttargettype/ for +=, ++, and for-in/of. Also add case for &&= which applies regardless of strict or sloppy.
  3. Add noStrict cases to annexB/language/expressions/assignment for =, +=, ++, and for-in/of which check that:
    • a ReferenceError is thrown
    • the function is called, but its return value is not resolved to a primitive
    • (= and += only) the RHS is not evaluated

Note: All hosts have some work to do.

  • V8: onlyStrict cases fail
  • SM: "its return value is not resolved to a primitive" fails for ++ (but += is OK)
  • JSC: ~~"the function is called" is never true~~ (WebKit/WebKit#44364)

rkirsling avatar Apr 21 '25 05:04 rkirsling

@rkirsling You should have tests where the function is named async to cover the case where the cover grammar is used.

michaelficarra avatar May 15 '25 02:05 michaelficarra

@michaelficarra Whoops, somehow missed your comment earlier. Updated now.

rkirsling avatar May 29 '25 08:05 rkirsling

Ready to merge whenever is convenient to synchronize with https://github.com/tc39/ecma262/pull/3568

ptomato avatar May 30 '25 10:05 ptomato

https://github.com/tc39/ecma262/pull/3568 has now been merged.

rkirsling avatar Jul 15 '25 00:07 rkirsling