Skip to content

[Bug]: Decorators/Constructor: method metadata leaks to class beta.36 #6079

@PointSingularity

Description

@PointSingularity

Reproduction link or steps

Reproduction

Run

pnpm i
pnpm build 
pnpm start

beta.36 version is going to produce an error

Output Diff

Image

What is expected?

Both should run successfully.

What is actually happening?

beta.36 is broken:

 [email protected] start /home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx
> pnpm run start:35 && pnpm run start:36


> [email protected] start:35 /home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx
> node dist-compare/entry-35.js

prob.run(): ok

> [email protected] start:36 /home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx
> node dist-compare/entry-36.js

TypeError: can't access property "getInfo", this.b is undefined
    at run (file:///home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx/dist-compare/entry-36.js:1077:4)
    at run (file:///home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx/dist-compare/entry-36.js:1113:17)
    at runProblem (file:///home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx/dist-compare/entry-36.js:1090:43)
    at entry.ts (file:///home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx/dist-compare/entry-36.js:1131:2)
    at <anonymous> (file:///home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx/dist-compare/entry-36.js:18:55)
    at  (file:///home/projects/rolldown-rolldown-starter-stackblitz-vq4vutgx/dist-compare/entry-36.js:1135:1)
    at _0x370799 (https://rolldownrolldownstarterstackbl-dkme.w-corp-staticblitz.com/blitz.96435430.js:31:827521)
    at run (https://rolldownrolldownstarterstackbl-dkme.w-corp-staticblitz.com/blitz.96435430.js:31:828286)
    at _0x1b2515 (https://rolldownrolldownstarterstackbl-dkme.w-corp-staticblitz.com/blitz.96435430.js:31:843394)
    at _evaluate (https://rolldownrolldownstarterstackbl-dkme.w-corp-staticblitz.com/blitz.96435430.js:31:843723)
    at evaluate (https://rolldownrolldownstarterstackbl-dkme.w-corp-staticblitz.com/blitz.96435430.js:31:840218)
    at run (node:internal/modules/esm/module_job:158:3371)

Node.js v20.19.1
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

System Info

System:
    OS: macOS 15.6.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 378.73 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.18.0 - ~/.proto/shims/node
    Yarn: 4.6.0 - ~/.proto/shims/yarn
    npm: 10.9.2 - ~/.proto/shims/npm
    pnpm: 10.9.0 - ~/.proto/shims/pnpm
    bun: 1.2.2 - ~/.proto/shims/bun
  Browsers:
    Chrome: 140.0.7339.81
    Edge: 140.0.3485.54
    Safari: 18.6

Any additional comments?

Sorry to be that guy, but it seems that experimental decorators + metadata are causing problems again 😅

In the 36 output, the class Problem is decorated with class-level metadata that says its constructor has zero params - __decorateMetadata("design:paramtypes", []). This is wrong for a subclass that relies on DI via the base constructor.

Not sure if this is a Rolldown regression or an OXC one, but it might be related to this. Hard to pinpoint what caused this as there was a big jump in OXC.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions