Skip to content

Implicit derived constructor over-allocates the rest array when forwarding to a base that captures ...args (trailing holes); the covering test is red on main #10635

Description

@proggeramlug

Found while fixing #10625 (PR #10634). This fails on current main — it is not caused by that PR, which was
confirmed by reproducing it with the fix stashed against unmodified main.

Repro

class Sink  { constructor(...parts) { console.log("P", parts); } }
class Drain extends Sink {}
new Drain("a", "b", "c");

Perry: P [ 'a', 'b', 'c', <5 empty items> ]
Node: P [ 'a', 'b', 'c' ]

A derived class with no own constructor gets an implicit one that forwards to super(...args). When the base
captures a rest parameter, the forwarded array is over-allocated and the trailing slots are left as holes.

It is already covered by a test that nobody sees fail

crates/perry/tests/issue_806_default_derived_ctor_forwarding.rs::walk_into_rest_param_capturing_ctor fails on
main today. Per CLAUDE.md, integration suites under crates/*/tests/*.rs run per-PR only when the diff names
them
(e2e-scoped); the sweep/full tiers' cargo test --workspace is the backstop, so a regression there lands
on main and is only attributed by sweep window. That is exactly what appears to have happened here — worth
checking whether this is a regression with an identifiable sweep window, or has been red since the test landed.

Likely related

#10623 — an implicit derived constructor does not forward its arguments to a native base's super() at all
(class NoCtor extends AsyncResource {} throws). This issue is the user-base counterpart: arguments are
forwarded, but the rest array is mis-sized. Both live in implicit-derived-constructor argument forwarding and may
share a root cause; whoever fixes one should check the other.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    package-auditFound by the 2026 package audit: compiling real npm packages from source instead of native bindings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions