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
thenables in object literals erroneously dropped with accompanying async/await/Promise #4102
Comments
That is unfortunately a known issue, but good to track here nonetheless. |
Sorry, I had missed #2915. This issue can be closed as a dup if you like. I think the only scenarios of concern are anything that could create a Promise like |
I actually closed the other one as your tests are much more comprehensive. |
That is actually tricky i.e. we cannot easily "scan" an object for properties from another node. A proper fix would likely mean introducing a new kind of effect (e.g. "hasEffectWhenAwaited"), at which point we might likely want to rework the effect system to work more like deoptimizations with an "event" parameter ("hasEffectWhenIterated" would be something else which would be nice to have so that we can eventually remove for-of loops). Will need to think about this. |
I see. I wonder if a quick hack could be implemented to pessimize the common uses of
The test case in the top post was further refined. |
As for the example in #2915: var count = 0;
var thenable = Object.defineProperty({}, 'then', { get: function () { count += 1; } });
Promise.resolve(thenable);
assert.equal(count, 1); if |
Fix at #4115 |
This is an obscure corner of the ECMAScript specification - thenables are similar to Promises:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve#resolving_thenables_and_throwing_errors
Repro
2.50.3 REPL
Expected Behavior
Actual Behavior
Edit 2: test case was further refined.
The text was updated successfully, but these errors were encountered: