Skip to content

In async function, returns a value in try block will before await statement in finally block #11960

Description

@zbinlin
  • Version: 7.7.3
  • Platform: Arch Linux

Testcase:

async function test() {
    try {
        console.log("1");
        return await Promise.resolve();
    } finally {
        console.log("2");
        await Promise.resolve();
        console.log("3");
    }
}

test().then(() => {
    console.log("4");
});

Expected:

1
2
3
4

Actual:

1
2
4
3

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions