ecma262 icon indicating copy to clipboard operation
ecma262 copied to clipboard

Step of Abstract Closure is specifed incorrectly in NewPromiseResolveThenableJob

Open dSalieri opened this issue 3 years ago • 2 comments

If you look at NewPromiseResolveThenableJob you will see next steps:

b. Let thenCallResult be Completion(HostCallJobCallback(then, thenable, « resolvingFunctions.[[Resolve]], resolvingFunctions.[[Reject]] »)).
c. If thenCallResult is an abrupt completion, then
  i. Return ? Call(resolvingFunctions.[[Reject]], undefined, « thenCallResult.[[Value]] »).
d. Return ? thenCallResult.

If I don't mistake step d specified incorrect. As I know sign ? means operation ReturnIfAbrupt that also shows that value can be abrupt completion. But here step d can't be abrupt completion because previous step protect from abruption. So I think step d should be written as:

d. Return ! thenCallResult

What do you think?

dSalieri avatar Jul 04 '22 13:07 dSalieri

It can also just be Return thenCallResult.[[Value]], since we know that thenCallResult is a Completion and it's obvious (from step c) that it's not an abrupt completion, even without asserting.

nicolo-ribaudo avatar Jul 04 '22 13:07 nicolo-ribaudo

@nicolo-ribaudo sure, I just noticed an inconsistency. In old spec it was Completion(thenCallResult).

dSalieri avatar Jul 04 '22 13:07 dSalieri