GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(codemode): pass the in-scope test262 class tests by jlongster · Pull Request #64965 · anomalyco/opencode

Conversation

@jlongster

@jlongster jlongster commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Builds on #64954 (classes); merge that first. Until it lands, this diff also shows its commits.

Type of change

  • Bug fix

What does this PR do?

#64954 skipped 334 test262 class tests. 86 of them are in scope (the rest cover extending built-ins, plain functions as parents or with new, extends null, and super() in an arrow). Grouped by cause:

Cause Tests Status
A derived constructor's return was checked inside its try blocks, before finally and the iterator close 6 fixed (5); the 6th needs super() in an arrow
Class constructors had no home object, so super.x failed in a constructor 3 fixed
super.x++, super.x op= v and delete super.x were refused at compile time 4 fixed
Class fields were defined without CreateDataPropertyOrThrow (frozen instance, static ['prototype']) 4 fixed
An anonymous class got its name after its static fields ran 1 fixed
super.x in object literal methods 3 fixed
Function.prototype had no restricted caller/arguments accessors 3 fixed
Destructuring ignores a user override of Array.prototype[Symbol.iterator] 48 still skipped (see below)
Out of scope: super() in an arrow (2), new on or extends a plain function (2) 4 still skipped
Gaps outside classes, in tests that happen to declare a class: Promise combinators called on a custom constructor (4), Iterator drop/take argument validation (2), concat on a non-array receiver (1), global this and import in global code (2) 9 still skipped

Why the 48 destructuring tests stay skipped: to pass them, array destructuring would have to check on every run whether Array.prototype[Symbol.iterator] was replaced, and that check would land on the array fast path that all code uses. Function and arrow versions of the same tests were already skipped on dev (64 of them), so this gap is older than classes.

The fixes also make 36 tests pass that were skipped before #64954: 26 restricted-property tests under built-ins/Function and statements/function, and 10 object-literal super tests.

How the main fixes work:

  • Derived constructor return: the check now runs when the constructor frame returns, and the error is thrown at the new call. The frame keeps its new target until super() binds this, and the snapshot allows that. The CTOR_RETURN opcode is gone.
  • Class fields: they now go through a class-only DEFINE_FIELD mode, so object literals keep the same path as before.
  • super in object literals: a new SET_HOME op runs only when a method actually uses super.

Skipped tests: 2681 on #64954, 2621 here (60 removed, none added). In-scope class tests skipped: 86 → 62.

How did you verify your code works?

In packages/codemode:

  • bun test: 21260 pass, 0 fail.
  • bun test test/classes.test.ts test/classes-suspend.test.ts test/test262.test.ts, also with CODEMODE_ROUNDTRIP=1 for the class files: 0 fail.
  • bun run typecheck:tsc: passes.
  • bun run script/test262-report.ts: lists which skipped tests pass now.

New cases in test/classes.test.ts: super updates and compound assignment, delete super.x, a frozen instance, anonymous class names, and object-literal super.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none" stroke="currentColor" stroke-width="2" font-family="monospace" font-size="11">
<style>.c{animation:t 3s infinite}.d{animation-delay:.5s}.e{animation-delay:1s}.f{animation-delay:1.5s}@keyframes t{0%,20%{opacity:.25}35%,100%{opacity:1}}</style>
<rect x="8" y="8" width="96" height="56" rx="6" opacity=".4"/>
<text x="18" y="30" fill="currentColor" stroke="none">class B</text>
<text x="18" y="48" fill="currentColor" stroke="none" opacity=".6">extends A</text>
<g class="c"><path d="M128 18l5 5 9-10"/><text x="150" y="23" fill="currentColor" stroke="none">super.x++</text></g>
<g class="c d"><path d="M128 36l5 5 9-10"/><text x="150" y="41" fill="currentColor" stroke="none">return</text></g>
<g class="c e"><path d="M128 54l5 5 9-10"/><text x="150" y="59" fill="currentColor" stroke="none">fields</text></g>
</svg>

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jlongster added 15 commits November 19, 2026 18:20
@jlongster
feat(codemode): base classes with constructors and methods
176764c
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
@jlongster
feat(codemode): public instance and static class fields
79ed92a
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
@jlongster
feat(codemode): class accessors, computed names, and generator and as…
8d6247f
…ync methods

User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
@jlongster
feat(codemode): class inheritance with super
b6920d2
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
@jlongster
feat(codemode): classes extending Error
e2be3c0
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
@jlongster
feat(codemode): show class names, translate instances to the host, an…
fce920d
…d test suspend at every class point

User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Test suspend/resume at every point class code runs
@jlongster
feat(codemode): clear errors for unsupported class features
3f06155
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
@jlongster
test(codemode): run test262 class tests
2d2dab0
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
@jlongster
fix(codemode): check a derived constructor's return after finally and…
f2f7110
… iterator close

User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Pass every in-scope test262 class test
@jlongster
fix(codemode): give class constructors a home object for super.x
163e462
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Pass every in-scope test262 class test
@jlongster
fix(codemode): support super.x updates, compound assignment and delet…
ea55c32
…e super.x

User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Pass every in-scope test262 class test
@jlongster
fix(codemode): throw when a class field cannot be defined
6bd3942
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Pass every in-scope test262 class test
@jlongster
fix(codemode): name an anonymous class before its static fields run
f4923df
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Pass every in-scope test262 class test
@jlongster
fix(codemode): give Function.prototype restricted caller and argument…
6d64d69
…s accessors

User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Pass every in-scope test262 class test
@jlongster
fix(codemode): support super.x in object literal methods
ffe716b
User decisions:
- Basic class support: declarations, constructors, methods, statics, fields, get/set, extends with super, extends Error
- No private fields, static blocks, or new on plain functions
- Pass every in-scope test262 class test
@github-actions github-actions Bot added the contributor label Nov 19, 2026
@jlongster
jlongster enabled auto-merge (squash) November 19, 2026 19:16
@jlongster
jlongster merged commit ca729da into dev Nov 19, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@jlongster
jlongster deleted the classes-test262 branch November 19, 2026 19:21
opencodejr[bot]
opencodejr Bot reviewed Nov 19, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found no blocking problems. I checked the change by running the same small programs on the head of #64954 and on this PR. On #64954:

  • super.x++ and super in object-literal methods are refused when the program is compiled.
  • An anonymous class sees "" as its name in its static fields.
  • A frozen instance still lets a field be defined.
  • A derived constructor that returns without calling super(), from inside a try, throws TypeError instead of ReferenceError.

With this PR, all four behave as the spec says. I also tried edge cases: compound and logical super assignment (instance, static, through an arrow), static ['prototype'] fields, returns from inside try/finally and for…of, and object-literal getters and setters that use super. All of them were correct.

The full bun test, the vendored test262 run at the pinned revision (0 fail), the class tests with CODEMODE_ROUNDTRIP=1, and typecheck:tsc all pass.

The public API is unchanged: everything stays inside the codemode language layer. One behaviour change to be aware of: reading caller or arguments on any function now throws a TypeError instead of returning undefined. That matches strict-mode JavaScript.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kommander added a commit that referenced this pull request Nov 19, 2026
@kommander
feat(codemode-rust): classes, ported from #64965, and BYTES_PER_ELEME…
0962708
…NT from #64930

Class declarations and expressions with constructors only new may call,
instance and static methods, accessors and fields, extends of classes and
Error types, super(...) and super.x reads, writes, calls, compound
assignments and deletes (also in object literal methods), home objects,
derived constructors' this before super() and their return rules,
Function.prototype's restricted caller and arguments, class names in
console.log, and the reference's texts for refused class syntax,
decorators and private names. An element read or written with an object
key now calls a program getter or setter, and a function under a computed
key is named by it. Uint8Array, its prototype and Buffer get
BYTES_PER_ELEMENT. #64919 changes only test hooks. Recordings regenerated
from the reference, with class cases from its tests.
@BrewTestBot BrewTestBot mentioned this pull request Nov 23, 2026
opencode 2.4.0 Homebrew/homebrew-core#327368
Merged
@amrkmn amrkmn mentioned this pull request Nov 23, 2026
opencode 2.4.0 amrkmn/homebrew-tap#1251
Closed
1 task
@github-actions github-actions Bot mentioned this pull request Nov 23, 2026
feat: opencode release v2.4.0 sprisa/opencode-server#95
Merged
@scottames-github-bot scottames-github-bot Bot mentioned this pull request Nov 27, 2026
chore(deps): update ⬆️ mise-packages scottames/dots#1181
Merged
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jlongster
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.