-
Notifications
You must be signed in to change notification settings - Fork 481
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
test: adding async optional chaining tests #2337
Conversation
0a547a5
to
434ca29
Compare
test/language/expressions/optional-chaining/member-expression-async-identifier.js
Outdated
Show resolved
Hide resolved
test/language/expressions/optional-chaining/member-expression-async-identifier.js
Outdated
Show resolved
Hide resolved
test/language/expressions/optional-chaining/member-expression-async-identifier.js
Outdated
Show resolved
Hide resolved
test/language/expressions/optional-chaining/member-expression-async-this.js
Outdated
Show resolved
Hide resolved
...anguage/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js
Outdated
Show resolved
Hide resolved
...anguage/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js
Outdated
Show resolved
Hide resolved
...anguage/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js
Outdated
Show resolved
Hide resolved
test/language/expressions/optional-chaining/optional-chain-async-square-brackets.js
Outdated
Show resolved
Hide resolved
test/language/expressions/optional-chaining/optional-chain-async-square-brackets.js
Outdated
Show resolved
Hide resolved
test/language/expressions/optional-chaining/optional-chain-async-square-brackets.js
Outdated
Show resolved
Hide resolved
…async-identifier.js Co-Authored-By: Leo Balter <[email protected]>
…nc-square-brackets.js Co-Authored-By: Leo Balter <[email protected]>
…async-this.js Co-Authored-By: Leo Balter <[email protected]>
…nc-optional-chain-square-brackets.js Co-Authored-By: Leo Balter <[email protected]>
…nc-optional-chain-square-brackets.js Co-Authored-By: Leo Balter <[email protected]>
…nc-square-brackets.js Co-Authored-By: Leo Balter <[email protected]>
…nc-square-brackets.js Co-Authored-By: Leo Balter <[email protected]>
…nc-optional-chain-square-brackets.js Co-Authored-By: Leo Balter <[email protected]>
…async-identifier.js Co-Authored-By: Leo Balter <[email protected]>
@leobalter I've updated the tests, I'm not following this one production however: Promise.prototype.y = 43;
var res = await Promise.reject(undefined)?.y;
assert.sameValue(res, 43, 'await unwraps the evaluation of the whole optional chaining expression #2'); I believe this would result in an exception being thrown, not 43 being resolved; can we just drop it? |
await does not unwrap the rejected promise, that's the tricky part. The optional chaining will evaluate the This might illustrate better the same resolution: var prom = Promise.reject(undefined);
var res = await (prom?.y);
// or
var evaluation = prom?.y;
var res = await evaluation; The test case is interesting as it verifies the order for runtime evaluation. We can add this in a follow up too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applying the mentioned "reject to chain" part in a follow up.
It's applied already. No need to follow up.
@leobalter my concern was, at least in Node.js:
bubbles to an unhandled rejection and fails the test. |
that doesn't make the test incorrect, right? We can't block tests because a specific host has a non specific behavior, and I believe Node might have some flag to ignore non handled rejections. In this case, Node is even doing the correct evaluation but the warning is triggering a test failure in some test262 runner. It's important to have these tests, and I believe this is not gonna be the first test here with this rejection swallowing. |
@leobalter I trust you 😄, was mainly concerned I was unable to validate in the test runner I had pulled together. |
CC: @leobalter, @rkirsling
see: #2263