Skip to content

add tests for TA.prototype.with/filter shrinking/detaching buffer during coercion - #5136

Merged
Ms2ger merged 3 commits into
mainfrom
ta-coercion-errors
Sep 21, 2026
Merged

Ms2ger merged 3 commits into
mainfrom
ta-coercion-errors

Conversation

@bakkot

@bakkot bakkot commented Sep 17, 2026

Copy link
Copy Markdown
Member

For tc39/ecma262#3979. Written by an LLM based off that PR.

These pass in the engines I have on hand except that some of them fail in Boa, which asserts as the spec currently (and incorrectly) does.

Also added the test/built-ins/TypedArray/prototype/with/BigInt/negative-index-resize-to-out-of-bounds.js because my version of Node throws the wrong error in that case for some reason (but v8 gets it right).

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

9 new or modified tests were run on 7 engines.

View workflow run

Test Engine262 GraalJS JavaScriptCore QuickJS SpiderMonkey V8 XS
built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer-kept-undefined.js ❌ ✅ ❌ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js ✅ ✅ ✅ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/filter/BigInt/callbackfn-shrink-kept-undefined.js ❌ ✅ ❌ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js ✅ ✅ ✅ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js ❌ ✅ ✅ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/with/BigInt/negative-index-resize-to-out-of-bounds.js ✅ ✅ ✅ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js ❌ ✅ ✅ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/with/index-coercion-shrinks.js ✅ ✅ ✅ ✅ ✅ ✅ ✅
built-ins/TypedArray/prototype/with/value-coercion-shrinks.js ✅ ✅ ✅ ✅ ✅ ✅ ✅

@bakkot

bakkot commented Sep 17, 2026

Copy link
Copy Markdown
Member Author

Huh, surprised by the jsc failures; it works on my machine.

Comment thread test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js Outdated
Comment thread test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js Outdated
Comment thread test/built-ins/TypedArray/prototype/with/BigInt/index-coercion-shrinks.js Outdated
Comment thread test/built-ins/TypedArray/prototype/with/BigInt/value-coercion-shrinks.js Outdated
Comment thread test/built-ins/TypedArray/prototype/with/index-coercion-shrinks.js Outdated
Comment thread test/built-ins/TypedArray/prototype/with/value-coercion-shrinks.js Outdated
Comment thread test/built-ins/TypedArray/prototype/filter/BigInt/callbackfn-detachbuffer.js Outdated
Comment thread test/built-ins/TypedArray/prototype/filter/callbackfn-detachbuffer.js Outdated
@gibson042
gibson042 requested a review from linusg September 18, 2026 16:19
bakkot and others added 3 commits September 21, 2026 10:09
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
@Ms2ger
Ms2ger enabled auto-merge (squash) September 21, 2026 08:10
@Ms2ger
Ms2ger merged commit 0a888ef into main Sep 21, 2026
17 checks passed
@Ms2ger
Ms2ger deleted the ta-coercion-errors branch September 21, 2026 08:11
lahma added a commit to sebastienros/jint that referenced this pull request Sep 24, 2026
…rinking coercion (#4157)

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.


Claude-Session: https://claude.ai/code/session_01PanPJbBD7pQC9fRiTpHxvs

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

4 participants