[ty] Only treat recursive types with unbounded specializations as fallback cycles - #27538
Open
mtshiba wants to merge 11 commits into
Open
[ty] Only treat recursive types with unbounded specializations as fallback cycles#27538mtshiba wants to merge 11 commits into
mtshiba wants to merge 11 commits into
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 96.96%. The percentage of expected errors that received a diagnostic held steady at 92.96%. The number of fully passing files held steady at 106/133. |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownsphinx
prefect
trio
|
|
mtshiba
force-pushed
the
recursive-type-may-diverge
branch
from
August 6, 2026 04:21
5a0bd94 to
132cc5a
Compare
mtshiba
force-pushed
the
recursive-type-may-diverge
branch
2 times, most recently
from
August 6, 2026 16:48
20099d2 to
4a481b9
Compare
mtshiba
force-pushed
the
recursive-type-may-diverge
branch
2 times, most recently
from
August 7, 2026 01:48
da5e860 to
5e982bf
Compare
mtshiba
force-pushed
the
recursive-type-may-diverge
branch
from
August 7, 2026 06:46
5e982bf to
5249d00
Compare
mtshiba
marked this pull request as ready for review
August 7, 2026 10:37
carljm
self-requested a review
August 7, 2026 19:08
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
Fixes #26503 (comment)
Approach #26989 didn't work. This would be a more legitimate approach.
In #26503, regardless of what the recursive type was, if it appeared again with a different specialization during the visit of
CycleDetector, there was a risk that the visit would not stop, so aCyclestate was returned immediately.This is OK for the growing pattern, but misses the saturating pattern, as shown below.
Think of this as a graph problem. The type parameter of each definition is used as a node, and the following edges are created from the type parameter of the recursive reference.
If there is even one nested edge in the directed cycle containing the root formal type argument, it is determined that the specialization can increase infinitely.
e.g.
Test Plan
mdtest updated