Skip to content

[ty] Make lazy type traversal explicit - #29155

Open
charliermarsh wants to merge 2 commits into
charlie/lazy-type-traversalfrom
charlie/codex-explicit-type-visitors
Open

charliermarsh wants to merge 2 commits into
charlie/lazy-type-traversalfrom
charlie/codex-explicit-type-visitors

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

All remaining callers of any_over_type and find_over_type use the old false behavior: walk stored nested types without evaluating lazy attributes. The flag no longer varies between callers, so we remove it and make that traversal the fixed behavior of both helpers.

Analyses that need lazy attributes now choose them explicitly. Visitors override the methods for the types they need to expand; for example, the recursion check explicitly visits alias values, protocol members, TypedDict fields, type-variable attributes, and NewType bases. Specialized alias searches can still compose the general helper: any_over_type_expanding_aliases uses it to walk stored types and explicitly recurses into alias values.

This preserves existing traversal behavior while removing the visitor-wide lazy-attribute switch and the shared search modes.

@charliermarsh charliermarsh added internal An internal refactor or improvement (not for changelogs) ty The ty type checker labels Oct 6, 2026
@astral-sh-bot

astral-sh-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 98.24%. The percentage of expected errors that received a diagnostic held steady at 98.24%. The number of fully passing files held steady at 134/146.

@astral-sh-bot

astral-sh-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@charliermarsh
charliermarsh marked this pull request as ready for review October 7, 2026 01:25
@charliermarsh
charliermarsh requested a review from a team as a code owner October 7, 2026 01:25
@charliermarsh
charliermarsh force-pushed the charlie/codex-explicit-type-visitors branch from bdc926b to e4d8601 Compare October 7, 2026 02:00

This branch was successfully deployed

1 active deployment
automations — e4d86010 Deployed Oct 7, 2026 by charliermarsh via security-review / security review #90919
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement (not for changelogs) ty The ty type checker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant