test262 icon indicating copy to clipboard operation
test262 copied to clipboard

Fix incorrect tests for `CreateDynamicFunction`

Open jedel1043 opened this issue 1 year ago • 2 comments

PR https://github.com/tc39/ecma262/pull/3222 changed the evaluation order for ToString(bodyArg) and ToString(arg), making it so that the body is converted to a string before the args, which differs from the previous behaviour.

For reference:

CreateDynamicFunction (ES draft)

...
7. Let bodyString be ? ToString(bodyArg).
8. Let parameterStrings be a new empty List.
9. For each element arg of parameterArgs, do
    a. Append ? ToString(arg) to parameterStrings.
...

CreateDynamicFunction (ES 2023)

...
10. If argCount > 0, then
    a. Let firstArg be parameterArgs[0].
    b. Set P to ? ToString(firstArg).
    ...
    d. Repeat, while k < argCount,
       i. Let nextArg be parameterArgs[k].
       ii. Let nextArgString be ? ToString(nextArg).
       ...
11. Let bodyString be the string-concatenation of 0x000A (LINE FEED), ? ToString(bodyArg), and 0x000A (LINE FEED).
...

jedel1043 avatar Feb 22 '24 06:02 jedel1043

Hold on, that ordering change might have not been intentional. @ptomato Do you remember if we talked about it?

nicolo-ribaudo avatar Feb 22 '24 08:02 nicolo-ribaudo

Hold on, that ordering change might have not been intentional. @ptomato Do you remember if we talked about it?

There were so many revisions requested, I'm actually not sure anymore. Looking through the history, it looks like I made that change in response to https://github.com/tc39/ecma262/pull/3222#discussion_r1445101746, but I can't remember if there was a conversation outside of GitHub.

ptomato avatar Feb 22 '24 16:02 ptomato

Closing in favour of tc39/ecma262/pull/3288

jedel1043 avatar Feb 27 '24 17:02 jedel1043