Skip to content

iterator_drop: a typed Set's finished iterator has value 0 - #16

Merged
ASDAlexander77 merged 1 commit into
mainfrom
typed-set-inference
Sep 30, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
typed-set-inference

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

This goes with ASDAlexander77/TypeScriptCompiler#416, which makes a generic class infer its type arguments from its constructor's arguments. Merge that one first, or the updated case fails: without it the Set is Set<any> and prints undefined.

new Set([1, 2, 3]) is now Set<si32> rather than Set<any>, so a finished iterator's value can't be undefined. It is 0, and the same compiler PR makes an unset value read as zero instead of garbage. The last case of iterator_drop.ts now asserts done and value == 0, instead of comparing against the any Set's printed { value: undefined, done: true }.

Results

With ASDAlexander77/TypeScriptCompiler#416:

  • gc: 158/158, compile and JIT.
  • rc: 3 of 316 runs fail, the known sleep/weakref_basic link errors.

The Set tests now exercise the typed path.

🤖 Generated with Claude Code

With the compiler inferring a generic class's type arguments from its
constructor's arguments, `new Set([1, 2, 3])` is a Set<si32> rather than
Set<any>, and a finished iterator's value cannot be undefined: it is 0
(garbage until the same compiler PR made an unset value zero). The last
case asserts `done` and that value instead of the `any` Set's printed text.

Co-Authored-By: Claude Opus 5.5 <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.

1 participant