Skip to content

tests: Map and Set forEach callbacks that keep their keys and values - #103

Merged
ASDAlexander77 merged 2 commits into
mainfrom
map-foreach-captures
Nov 16, 2026
Merged

ASDAlexander77 merged 2 commits into
mainfrom
map-foreach-captures

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Companion to ASDAlexander77/TypeScriptCompiler#872: merge that PR first.

tests/map_set_forEach_captures.ts: callbacks over a Map and a Set that keep what they are given.

  • They push keys and values into captured arrays.
  • They declare fewer parameters than forEach passes, and two of them over one Map disagree on what they keep.
  • The Map and the Set then delete an entry, and the arrays are checked.
  • It runs 100 rounds with keys built at run time, so a missing copy shows up as a double free.

Under -mm=own this needs the compiler change: each callback gets a copy of the string it keeps. With the compiler branch it passes under own, gc, none and rc (JIT), and the rest of the suite passes in all four models.

🤖 Generated with Claude Code

ASDAlexander77 and others added 2 commits November 16, 2026 13:53
Callbacks declaring fewer parameters than forEach passes, pushing the keys and values
into captured arrays, two of them over one Map; the Map and the Set then delete an
entry. Under -mm=own each callback gets a copy of what it keeps (compiler: own callbacks
declaring fewer parameters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 2bbe2a7 into main Nov 16, 2026
6 of 10 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.

1 participant