Skip to content

Fix downlevel async super in default parameters#4104

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-super-method-parameter-default
Draft

Fix downlevel async super in default parameters#4104
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-super-method-parameter-default

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 30, 2026

Downlevel async emit could leave super.m() inside the inner generator function when used in a default parameter. That produced invalid JavaScript because super is not legal in the generated function*.

  • Transform fix

    • Tracks super accesses before transforming non-simple async parameter lists.
    • Applies the existing async super substitution to inner generator parameters as well as the body.
  • Regression coverage

    • Adds a compiler emit test for both async arrow and async method default parameters:
class C extends B {
    f() {
        const g = async (b = super.m()) => b;
        return g();
    }

    async h(b = super.m()) {
        return b;
    }
}

These now downlevel default initializers to _super.m.call(this) inside the generated function*.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix super.m() behavior in downleveled async functions Fix downlevel async super in default parameters May 30, 2026
Copilot AI requested a review from jakebailey May 30, 2026 16:28
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 this pull request may close these issues.

super.m() in a downleveled async function's parameter default survives into the inner function*

2 participants