[ty] Add with_recursion_guard() helpers to relation.rs#23945
Merged
AlexWaygood merged 1 commit intomainfrom Mar 13, 2026
Merged
[ty] Add with_recursion_guard() helpers to relation.rs#23945AlexWaygood merged 1 commit intomainfrom
with_recursion_guard() helpers to relation.rs#23945AlexWaygood merged 1 commit intomainfrom
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 85.29%. The percentage of expected errors that received a diagnostic held steady at 78.13%. The number of fully passing files held steady at 64/132. |
|
Memory usage reportMemory usage unchanged ✅ |
ibraheemdev
approved these changes
Mar 13, 2026
carljm
added a commit
that referenced
this pull request
Mar 16, 2026
* main: (131 commits) [ty] Fixup examples in `invalid-key` docs (#23968) [ty] Fix compiler warning about unused variable (#23967) [ty] Sync vendored typeshed stubs (#23963) Add a `.git-blame-ignore-revs` file (#23959) Revert "[ty] Completely remove the `NoReturn` shortcut optimization" (#23955) [ty] Completely remove the `NoReturn` shortcut optimization (#23378) [ty] Introduce fast path for protocol non-assignability (#23952) Bump typing conformance suite SHA (#23951) Minor followup to severity display - use preview function in server instead of checking preview disabled directly (#23950) Document editor features for markdown code formatting (#23924) [ty] Add `with_recursion_guard()` helpers to `relation.rs` (#23945) [ty] Remove `check_optional_method_pair` methods (#23947) [ty] Remove unused `CycleDetector::try_visit` method (#23944) [ty] Ensure TypedDict subscripts for unknown keys return Unknown (#23926) [ty] Fix variance of frozen dataclass-transform models (#23931) Display output severity in preview (#23845) Revert "[`ruff`] use `bitcode` instead of `bincode`" (#23935) Fix shell injection via `shell=True` in subprocess calls (#23894) [ty] Refactor `relation.rs` to store state on a struct rather than passing around 7 arguments every time we recurse (#23837) Don't return code actions for non-Python documents (#23905) ...
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
A small followup to #23837 to further improve readability. Rather than repeating
self.relation_visitor.visit((source, target, self.relation, || {})everywhere, add a helper method so that we can callself.with_recursion_guard(source, target, || {})instead. This ends up being exactly neutral in terms of lines of code added/removed, but I think it makes the big recursivematches inTypeRelationChecker::check_type_pairandDisjointnessChecker::check_type_pairsignificantly more readable. (And these are two of the most complex and important methods in ty's codebase.)Test Plan
existing tests