Repository navigation
Bump test262 to 7ab7fafa; fix TypedArray.prototype.with after a shrinking coercion - #4157
Merged
Merged
Conversation
…rinking coercion Moves SuiteGitSha 35d56660 -> 7ab7fafa (5 upstream commits, test-only, no features.txt change) and recomputes CorpusContentSha256 over the new tree. %TypedArray%.prototype.with bulk-copied the length it read before coercing the index and the value, so a coercion that shrank a resizable buffer made Array.Copy read past the reallocated block and a CLR ArgumentException escaped into the host. It now copies only the elements the source still has and writes undefined through TypedArraySetElement for the rest (NaN, +0, or a TypeError for BigInt), per tc39/ecma262#3979 as tested by tc39/test262#5136. intl402/DateTimeFormat/prototype/format/german-weekday-no-year.js parks under the INTL402 banner: it needs CLDR availableFormats skeleton matching and format-context weekday names, which the component-bag lane lacks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PanPJbBD7pQC9fRiTpHxvs
lahma
added a commit
that referenced
this pull request
Oct 5, 2026
…g coercion (#4218) Adapted from 431590d (engine fix and regression tests only; the test262 pin is not bumped). %TypedArray%.prototype.with bulk-copied the length read before coercing the index and the value, so a coercion that shrank a resizable buffer made Array.Copy read past the reallocated block and a CLR ArgumentException escaped into the host. It now copies only the elements the source still has and writes undefined through TypedArraySetElement for the rest (NaN, +0, or a TypeError for BigInt). Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Pin
SuiteGitSha35d566604512cba908054eec49f85e64a59f30917ab7fafa0003f73fc85c1b95d88094d33f7eb8bd(tc39/test262mainhead, confirmed withgit ls-remote)CorpusContentSha25653f0415391f9b10732861cebc6f4d1229350c9367347e6d98102f59f76e19ff03a5186f786877400125b6ab4a73e4528821faa911527bd8e6ba69c92c000a23dThe digest was recomputed from the local git tree with a script that mirrors
Test262CorpusAcquisition.ComputeDigest: ordinal-sorted/harnessand/testpaths, each hashed as an int32-LE length, the UTF-8 path, then SHA-256(content). As a check, the script reproduces the old committed digest exactly for35d56660(53,945 files). The new tree has 53,955 files, which is the 10 added in the range. The runner then downloaded the GitHub archive and accepted it against the new digest, so two independent computations agree.Commit range
35d56660..7ab7fafa(5 commits)No
features.txtchange. Nothing outsidetest/changed.95ad0fc2-u-<ukey>-true/-yescoverage now includes digit-first ukeys0a888ef3TypedArray.prototype.{with,filter}when a coercion or callback shrinks or detaches the buffer, for tc39/ecma262#3979 (open, "has test262 tests":! TypedArraySetElement→?)with: 8 failures;filter: passes045bf6f9{weekday: "short", day, month: "long"}must contain"Sa.,"020f5c80ToRawPrecision)7ab7fafaformatToPartsfor the sameFailures before → after
The 10 failures were
TypedArray/prototype/with/{index,value}-coercion-shrinks.jsand theirBigInt/versions (4 files × 2 modes), plusgerman-weekday-no-year.js(2 modes). All 8withfailures were the same CLR exception escaping into script:Fix:
%TypedArray%.prototype.with— https://tc39.es/ecma262/#sec-%typedarray%.prototype.withWithreadslen, then coerces the index and the value. Either coercion can run script that shrinks a resizable buffer, andJsArrayBuffer.Resizereallocates the block. The step-9IsValidIntegerIndexcheck only proves thatactualIndexsurvived.Withthen bulk-copiedlen * elementSizebytes out of the shorter block. It now copiesmin(len, current length)elements. Every missing element goes throughTypedArraySetElement(A, k, undefined), which is step 12.c/e as corrected by tc39/ecma262#3979:NaNfor float arrays,+0for integer arrays, and aTypeErrorfor BigInt arrays. The<remarks>names the open PR, because the published prose still says!. The bulk-copy fast path is unchanged whenever nothing shrank.filteralready propagated theTypeError, becausea[n] = kept[n]goes through the throwing setter, so it needed no change.Parked:
intl402/DateTimeFormat/prototype/format/german-weekday-no-year.jsThis goes under the existing
=== INTL402 EXCLUSIONS ===banner, with a comment naming what removes it. Jint writes"Sa 24 Dezember"; CLDR's GermanMMMMEdis"EEE, d. MMMM", which gives"Sa., 24. Dezember". Passing needs two things this engine does not have:availableFormatsthrough a format matcher (https://tc39.es/ecma402/#sec-createdatetimeformat).JsDateTimeFormat.FormatWithComponents/FormatComponentsToPartsinstead assemble fields inShortDatePatternorder with fixed separators. The same gap is why English prints"Sat December 24"where CLDR says"Sat, December 24".AbbreviatedDayNamesare ICU's stand-alone forms ("Sa"). The format-context"Sa."is not reachable throughDateTimeFormatInfo, andICldrProvider.GetWeekdayNameshas no context parameter.This is too large for a sync PR. A real fix needs a pattern source on
ICldrProvider(public surface), a .NET-derived fallback forDefaultCldrProvider, a format matcher, and a rewrite of the string, parts and range lanes onto the matched pattern. It is intl402 only, so the banner invariant holds.Unit tests — failing first
New file
Jint.Tests/Runtime/TypedArrayWithShrinkTests.cs. It covers index- and value-coercion shrinks for every numeric element type, both BigInt types (TypeError), and Float16 (gated with[IgnoreUnless]onSystem.Half, likeDataViewBoundsTests). It also has guards for the RangeError on a negative index shrunk out of bounds, a length-tracking buffer that grows during coercion, and an unshrunk offset view. Each case runs in script with its owncatch, so a leaking CLR exception fails the test instead of passing as an error.main'sIntrinsicTypedArrayPrototype.cs)Before the fix, all 70 failures were the
ArgumentExceptionabove (net48's Float16 rows fail onHalffirst). The 18 passing cases are the six guards × 3 TFMs, which are meant to pass on both sides. The 2 skipped cases are net48's Float16 rows.SpecAnchors.txtgainsecma262 sec-%typedarray%.prototype.with(count 1259 → 1260). The anchor was checked againsttc39/ecma262spec.html.Other suites
Jint.Tests: 34,022 total / 34,006 passed / 0 failed / 16 skipped (net10.0, net8.0, net48)Jint.Tests.PublicInterface: 10,474 / 10,411 / 0 / 63. The first full run had one net48 failure inHostPumpAdmissionTests.AnAdmittedCallbackHoldsTheParkPastItsCeiling("the canary was admitted by an engine the park had already released"), a host-pump timing test this diff does not touch. The class then passed 3/3 in isolation, and a second full run was green.🤖 Generated with Claude Code
https://claude.ai/code/session_01PanPJbBD7pQC9fRiTpHxvs