Repository navigation
Answer Error.prototype for Object.getPrototypeOf of an Error - #2058
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
An Error's view had no prototype or a holder of its default name and message, so Object.getPrototypeOf(new Error()) was Object.prototype or a fresh object. A view of an error built as an Error, whose prototype is still the one its view starts with, now answers Error.prototype. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cramforce
force-pushed
the
fix/error-proto
branch
from
October 24, 2026 00:47
b5e7d39 to
1b5c905
Compare
Contributor
Author
|
Verification for 1b5c905 (rebased onto origin/main 4206155). Differential. Corpus Zero-cost gate against main 4206155, full sets: bench, self and the TypeScript corpus.
No typed benchmark changes. The gate's FAIL verdict on the corpus set comes from those 56 programs alone: the gate ran without |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cramforce
marked this pull request as ready for review
October 24, 2026 02:57
Object.getPrototypeOf of an Error answers Error.prototype when the error's view was built from its fields and its prototype is still the object the view was built with. After Object.setPrototypeOf(error, {}), it answers the object that was set.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Natively,
Object.getPrototypeOf(new Error())answeredObject.prototypeor a fresh holder object instead ofError.prototype. The view of an error built as an Error, while its prototype is still the one the view starts with, now answersError.prototype. Other error kinds keep their current behavior, because their prototypes are not modeled.The change is runtime-only, in
scr_dyn_get_prototype(scr_json.c).Evidence: corpus
8115-error-prototype-identity.js, with its order baseline and CI cost recorded. It fails on main and matches Node in the plain and sanitized lanes.Zero-cost gate against main, full sets (bench, self and the TypeScript corpus): bench and self are identical. 56 corpus programs that reach
scr_dyn_get_prototypechange in their release executable only, from +0 to +8.5 KB (median +288 B). IR and LLVM are identical everywhere. Details are in the verification comment.🤖 Generated with Claude Code