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

thenables not invoked from async arrow functions #4116

Closed
kzc opened this issue May 30, 2021 · 1 comment · Fixed by #4120
Closed

thenables not invoked from async arrow functions #4116

kzc opened this issue May 30, 2021 · 1 comment · Fixed by #4120

Comments

@kzc
Copy link
Contributor

kzc commented May 30, 2021

  • Rollup Version: rollup v2.50.5
  • Operating System (or Browser): n/a
  • Node Version (if applicable): node v16.1.0

Async arrows were not covered in #4115.

Repro

$ cat async-then.js 
// async function
(async function () {
    return {
        get then() {
            return () => effect(11);
        }
    };
})();
// async arrow with block
(async () => {
    return {
        get then() {
            return () => effect(12);
        }
    };
})();
// async arrow without block
(async () => ({
    get then() {
        return () => effect(13);
    }
}))();
const effects = [], effect = x => effects.push(x);
Promise.resolve({
    then(resolve) {
        resolve({
            then(resolve) {
                console.log(effects.join(" "));
            }
        });
    }
});

Expected Behavior

$ cat async-then.js | node
11 12 13

Actual Behavior

$ cat async-then.js | rollup --silent | node
11
$ cat async-then.js | rollup --silent
// async function
(async function () {
    return {
        get then() {
            return () => effect(11);
        }
    };
})();
const effects = [], effect = x => effects.push(x);
Promise.resolve({
    then(resolve) {
        resolve({
            then(resolve) {
                console.log(effects.join(" "));
            }
        });
    }
});
@lukastaegert
Copy link
Member

Fix at #4120

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

Successfully merging a pull request may close this issue.

2 participants