Skip to content
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

Promise.resolve should consider side-effect in thenables #2915

Closed
lukastaegert opened this issue Jun 10, 2019 · 1 comment
Closed

Promise.resolve should consider side-effect in thenables #2915

lukastaegert opened this issue Jun 10, 2019 · 1 comment

Comments

@lukastaegert
Copy link
Member

  • Rollup Version: 1.14.5
  • Operating System (or Browser): any
  • Node Version: any

How Do We Reproduce?

Taken from es6-shim:

var count = 0;
var thenable = Object.defineProperty({}, 'then', { get: function () { count += 1; } });
Promise.resolve(thenable);
assert.equal(count, 1);

Expected Behavior

Promise.resolve is retained if a thenable is provided that has a side-effect when then is accessed.

Actual Behavior

Promise.resolve is removed.
https://rollupjs.org/repl?version=1.14.6&shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMnZhciUyMGNvdW50JTIwJTNEJTIwMCUzQiU1Q252YXIlMjB0aGVuYWJsZSUyMCUzRCUyME9iamVjdC5kZWZpbmVQcm9wZXJ0eSglN0IlN0QlMkMlMjAndGhlbiclMkMlMjAlN0IlMjBnZXQlM0ElMjBmdW5jdGlvbiUyMCgpJTIwJTdCJTIwY291bnQlMjAlMkIlM0QlMjAxJTNCJTIwJTdEJTIwJTdEKSUzQiU1Q25Qcm9taXNlLnJlc29sdmUodGhlbmFibGUpJTNCJTVDbmFzc2VydC5lcXVhbChjb3VudCUyQyUyMDEpJTNCJTIyJTJDJTIyaXNFbnRyeSUyMiUzQXRydWUlN0QlNUQlMkMlMjJvcHRpb25zJTIyJTNBJTdCJTIyZm9ybWF0JTIyJTNBJTIyZXNtJTIyJTJDJTIybmFtZSUyMiUzQSUyMm15QnVuZGxlJTIyJTJDJTIyYW1kJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIlMjIlN0QlMkMlMjJnbG9iYWxzJTIyJTNBJTdCJTdEJTdEJTJDJTIyZXhhbXBsZSUyMiUzQW51bGwlN0Q=

@lukastaegert lukastaegert changed the title Promise.resolve should trigger consider side-effect in thenables Promise.resolve should consider side-effect in thenables Jun 10, 2019
@lukastaegert
Copy link
Member Author

Closing in favour of #4102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant