Repository navigation
iterator_drop: a typed Set's finished iterator has value 0 - #16
Merged
Merged
Conversation
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>
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.
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 printsundefined.new Set([1, 2, 3])is nowSet<si32>rather thanSet<any>, so a finished iterator'svaluecan't beundefined. It is0, and the same compiler PR makes an unset value read as zero instead of garbage. The last case ofiterator_drop.tsnow assertsdoneandvalue == 0, instead of comparing against theanySet's printed{ value: undefined, done: true }.Results
With ASDAlexander77/TypeScriptCompiler#416:
sleep/weakref_basiclink errors.The Set tests now exercise the typed path.
🤖 Generated with Claude Code