Skip to content

fix(runtime): align borrowed typedarray prototype methods#4427

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/typedarray-branded-methods
Jun 4, 2026
Merged

fix(runtime): align borrowed typedarray prototype methods#4427
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/typedarray-branded-methods

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

@andrewtdiz andrewtdiz commented Jun 4, 2026

Refs #4315

Summary

  • Adds a regression fixture for %TypedArray%.prototype methods borrowed via .call, covering non-TypedArray TypeErrors and Uint8Array/Buffer receivers.
  • Accepts Perry buffer-backed Uint8Array/Buffer receivers in TypedArray prototype thunks after the existing brand check, while still rejecting arrays and prototype-shaped objects.
  • Implements the buffer-backed Uint8 method path for map, filter, slice, subarray, copyWithin, fill, reverse, sort, toReversed, toSorted, findIndex, findLastIndex, and set.
  • Preserves Uint8Array vs Buffer result identity and omitted optional-arg defaults for copyWithin/fill.

Validation

  • cargo check -p perry-runtime
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh
  • Focused parity harness for globals/typedarray-branded-methods passed before the final expanded Buffer result-identity cases were added; the final expanded fixture was then manually compared against Node 26 and matched exactly.
  • Manual Node 26/Perry comparisons matched for typedarray-callback-result-indexes, typedarray-own-properties, typedarray-prototype-accessor-throws, buffer/from/typed-array, buffer/typed-array/set, and buffer/copy-slice/subarray-shared.

@andrewtdiz andrewtdiz changed the title fix(runtime): preserve typed array thunk optional args fix(runtime): align borrowed typedarray prototype methods Jun 4, 2026
@proggeramlug proggeramlug marked this pull request as ready for review June 4, 2026 18:03
@proggeramlug proggeramlug merged commit 252dbe9 into PerryTS:main Jun 4, 2026
13 checks passed
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.

2 participants