-
Notifications
You must be signed in to change notification settings - Fork 857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ES2021 Promise.any #1610
Conversation
One thing I realized is that AggregateError should throw a type error if not supplied with anything as it's first parameter or if is isn't iterable... Can't think of anything else yet |
Great stuff once again! And tnx for digging into the reasons behind the failing tests as well! Wrt the
Could you create follow-up cases for:
|
Not sure I get what you mean here. Are you saying that AggregateErrors ought to behave like this according to the spec, but your implementation currently doesn't and that is not caught by the test262 test suite? |
On Firefox, if you do |
Following the referenced operations in the spec, I come to the conclusion that a TypeError should be thrown if the argument doesn't resolve to an iterator, so what FF does seems correct to me |
Ah I see, will add that. Should I add test cases for that? Haven't done that before. |
If test262 doesn't cover this scenario, you might file a case with them for this. If they act upon it quickly, we can just update to the newer version of test262 to get test coverage. Otherwise, a test ought to be added yes. I'm in favor of going the test262 route |
The second issue, about toPrimitive will likely be fixed by PR #1611 that was just created |
const object1 = {
[Symbol.toPrimitive]() {
return "toPrimitive"
},
toString() {
return "toString"
},
valueOf() {
return "valueOf"
}
};
> String(object1); In Rhino:
In FF:
https://tc39.es/ecma262/#sec-tostring
> function foo(x, y, z) {}
> Object.getOwnPropertyNames(foo) In Rhino: arguments,prototype,name,arity,length In FF: prototype,length,name The ordering is defined in https://tc39.es/ecma262/#sec-createbuiltinfunction |
This looks good to me-- any other comments, otherwise we should merge this. |
Note that the latest test262 now has a test for the AggregateError constructor throwing an error if the first param is not supplied |
Thanks -- I think that this is far enough that we can merge it, and we can follow up later to update test262. |
AggregateError/errors-iterabletolist-failures
fails becauseget [Symbol.iterator]()
doesn't work (not too sure why)TypeError: The object is not a string
AggregateError/message-tostring-abrupt
andAggregateError/message-tostring-abrupt-symbol
both failScriptRuntime.toString()
, which callsScriptableObject.getDefaultValue()
doesn't take into account the [Symbol.toPrimitive] property, it only checks fortoString()
orvalueOf()
. See ScriptableObject.getDefaultValue and the specAggregateError/newtarget-proto-fallback
fails because we don't support new.targetPromise/any/reject-element-function-property-order
fails. Other tests checking the order oflength
andname
seem to fail as wellFixes #1062