Skip to content

tests: #806 — systematic harness for class-extends-factory / mixin patterns#822

Open
proggeramlug wants to merge 2 commits into
mainfrom
worktree-fix-806-mixin-harness
Open

tests: #806 — systematic harness for class-extends-factory / mixin patterns#822
proggeramlug wants to merge 2 commits into
mainfrom
worktree-fix-806-mixin-harness

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

New test-files/test_harness_class_mixins.ts covers eight independent sub-cases of class X extends Fn(...)<...>, each emitting a stable section: result line so parity diffs pin exactly which sub-case regressed:

  1. Bare factory — class X extends makeBare()
  2. Parameterized factory — class X extends tagged(\"name\", schema)
  3. Captured-factory generic — class X extends makeNamed<T>(\"...\")
  4. Chained mixins — class X extends WithA(WithB(WithC(Base)))
  5. Mixin with super-arg forwarding
  6. Factory with static method
  7. Effect-shape double-call — class X extends TaggedError<X>()(\"tag\", schema)
  8. Parameterized mixin factory

What the harness surfaces today

Verified against node --experimental-strip-types on macOS (baseline prints 22 stable lines). Perry passes the parameterized-factory, captured-factory generic, and Effect double-call (post-#740) sub-cases — but the harness exposes two real gaps:

  • Bare factorybare.kind: undefined vs Node's bare.kind: bare. Base class's field initializer dropped when the parent is a factory-returned class expression.
  • Chained mixins — throws TypeError: value is not a function at construction; the layered WithA(WithB(WithC(Base))) shape doesn't resolve.

Both are linked to the #321 Effect umbrella. The harness is added to known_failures.json so this PR doesn't trip the parity gate; each sub-case flips to PASS independently as the underlying work lands.

Test plan

Closes #806.

…tterns

`class X extends Fn(...)<...>` had zero systematic coverage. This harness
covers eight independent sub-cases, each printing a stable `section:
result` line so parity diffs pin exactly which sub-case regressed:

1. Bare factory — `class X extends makeBare()`.
2. Parameterized factory — `class X extends tagged("name", schema)`.
3. Captured-factory generic — `class X extends makeNamed<T>("...")`.
4. Chained mixins — `class X extends WithA(WithB(WithC(Base)))`.
5. Mixin with super-arg forwarding.
6. Factory with static method.
7. Effect-shape double-call — `class X extends TaggedError<X>()("tag", schema)`.
8. Parameterized mixin factory — `ParamMixin<T>(seed)(Base)`.

Verified against `node --experimental-strip-types` on macOS; baseline
prints 22 stable lines. Perry currently passes sub-cases 2, 3, and the
captured Effect shape (post-#740) but surfaces two real gaps:

- **Bare factory** — `bare.kind: undefined` instead of `bare.kind: bare`.
  The base class's field initializer is dropped when the parent is a
  factory-returned class expression.
- **Chained mixins** — `TypeError: value is not a function` thrown
  before construction; the layered `WithA(WithB(WithC(...)))` shape
  doesn't resolve through the mixin chain.

Both are linked to the #321 Effect umbrella and added to
`known_failures.json` so this PR doesn't break the parity gate. Each
sub-case flips to PASS independently as the underlying lowering work
lands.
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.

tests: harness for dynamic class extension / mixins

1 participant