Port TypeScript#62676: Fix slow sync iteration types spoiling cached async iteration types#2728
Open
Port TypeScript#62676: Fix slow sync iteration types spoiling cached async iteration types#2728
Conversation
…hed value for async ones Move getIterationTypesOfIterableSlow calls inside their respective fast-check blocks to prevent sync slow iteration types from being resolved and cached before async slow types, which was causing incorrect async iteration types. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with slow sync iteration types
Port TypeScript#62676: Fix slow sync iteration types spoiling cached async iteration types
Feb 10, 2026
Member
|
Hm, this does nothing. Maybe we avoid the problem entirely now? |
Member
|
Probably worth pulling, just because this probably is an ordering thing we now just so happen to avoid in this case, but not others |
Contributor
There was a problem hiding this comment.
Pull request overview
Ports TypeScript#62676 to the Go checker to ensure for await...of prefers AsyncIterable iteration types over sync fallbacks, avoiding incorrect cached results when a type supports both sync and async iteration.
Changes:
- Reorders
getIterationTypesOfIterableWorkerresolution so async slow-path resolution completes before any sync-path fallback. - Shares a single
diagsslice across the async/sync slow paths for related diagnostic info.
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.
When a type implements both
Iterable<T_Sync>andAsyncIterable<T_Async>, the sync slow resolution path could cache results before the async slow path ran, causingfor awaitloops to incorrectly yield the sync type parameter instead of the async one.getIterationTypesOfIterableSlowcalls inside their respective fast-check blocks so async slow resolution always completes before sync slow resolution runs, preventing cache poisoning💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.