Skip to content

hir: class-expression capture-refresh edge cases — param defaults, multi-eval name-keying, top-level-block/arrow refresh owners (#6604 follow-up) #6654

Description

@proggeramlug

Consolidating three related CodeRabbit findings raised on PRs #6647/#6650/#6653 (all anchored in the #6604 class-expression capture-refresh machinery, merged via #6633). Each is a plausible correctness edge case that the semver-driven fix did not need, but that real code can hit. Needs verification against the shipped implementation first — the #6604 work includes multi-eval isolation tests that may already cover parts; treat these as claims to confirm or refute, with a parity fixture per case:

  1. Param-default class expressions are deliberately discarded (get_param_default self-truncates its entries). Claimed counterexample: function f(x, C = class { get() { return x } }) { x = 2; return C } — the default-evaluated class should observe the body's x = 2 (same parameter binding in Node). Verify perry's param-capture machinery doesn't already handle this via a different path.
  2. Name-keyed snapshot can cross-contaminate multi-evaluation factories: with A = make("a"); B = make("b"); new A(), refresh entries keyed by the shared template name could backfill A's stale slots from B's later snapshot. The hir: class-expression capture snapshot stale for vars assigned after the class — semver Comparator TypeError kills pi-native at init #6604 fix's ctor-prologue rebind + multi-eval tests may already cover this — confirm with an assigned-AFTER-class multi-eval fixture specifically (the existing tests reportedly cover assigned-before).
  3. Refresh-owner gaps: top-level block captures may strand entries (module-init refresh handling doesn't drain them); expression-bodied arrows may discard entries before later live-binding updates.

Each confirmed case: minimal fixture byte-identical to node + targeted fix keeping refreshes scoped to the evaluated class object (per-evaluation identity rather than shared-name keying, where required).

Refs: CodeRabbit inline comments on #6647 (lower_patterns.rs:1469, arm_class.rs:205), #6650 and #6653 (arm_class.rs:205).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions