Visitar URL original
[ty] Split deferred checks out of `types/infer/builder.rs` by AlexWaygood · Pull Request #23740 · astral-sh/ruff · GitHub
Skip to content

[ty] Split deferred checks out of types/infer/builder.rs - #23740

Merged
AlexWaygood merged 6 commits into
mainfrom
alex/split-infer-builder
Mar 5, 2026
Merged

AlexWaygood merged 6 commits into
mainfrom
alex/split-infer-builder

Conversation

@AlexWaygood

Copy link
Copy Markdown
Member

Summary

  • Add a new types::infer::deferred module to provide a new home for deferred checks.
  • Use a single loop over all definitions in the scope after the initial inference passrather than having multiple checks that each do their own loop
  • Convert all these checks into free functions rather than methods, reducing indentation and total lines of code.

Test Plan

Existing tests

@AlexWaygood AlexWaygood added internal An internal refactor or improvement (not for changelogs) ty The ty type checker labels Mar 5, 2026
@AlexWaygood
AlexWaygood force-pushed the alex/split-infer-builder branch from 49e6f66 to 23ed5bf Compare March 5, 2026 17:28
@astral-sh-bot

astral-sh-bot Bot commented Mar 5, 2026 •

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

@astral-sh-bot

astral-sh-bot Bot commented Mar 5, 2026 •

Copy link
Copy Markdown

mypy_primer results

Changes were detected when running on open source projects
scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/build/wheel.py:99:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 58 diagnostics
+ Found 57 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/deployments/runner.py:1017:70: error[unresolved-attribute] Attribute `__name__` is not defined on `((...) -> Any) & ((*args: object, **kwargs: object) -> object)` in union `Unknown | (((...) -> Any) & ((*args: object, **kwargs: object) -> object))`
+ src/prefect/deployments/runner.py:1017:70: error[unresolved-attribute] Attribute `__name__` is not defined on `(...) -> Any` in union `Unknown | ((...) -> Any)`
+ src/prefect/flow_engine.py:1004:32: error[invalid-await] `Unknown | R@FlowRunEngine | Coroutine[Any, Any, R@FlowRunEngine]` is not awaitable
+ src/prefect/flow_engine.py:1610:24: error[invalid-await] `Unknown | R@AsyncFlowRunEngine | Coroutine[Any, Any, R@AsyncFlowRunEngine]` is not awaitable
- src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
+ src/prefect/flows.py:286:34: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
- src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `((**P@Flow) -> R@Flow) & ((*args: object, **kwargs: object) -> object)` has no attribute `__name__`
+ src/prefect/flows.py:404:68: error[unresolved-attribute] Object of type `(**P@Flow) -> R@Flow` has no attribute `__name__`
- Found 5803 diagnostics
+ Found 5805 diagnostics

@astral-sh-bot

astral-sh-bot Bot commented Mar 5, 2026 •

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@AlexWaygood
AlexWaygood force-pushed the alex/split-infer-builder branch from 23ed5bf to a2df958 Compare March 5, 2026 17:53
@AlexWaygood
AlexWaygood marked this pull request as ready for review March 5, 2026 18:04
@AlexWaygood
AlexWaygood merged commit 4926bd5 into main Mar 5, 2026
50 checks passed
@AlexWaygood
AlexWaygood deleted the alex/split-infer-builder branch March 5, 2026 18:11
carljm added a commit that referenced this pull request Mar 5, 2026
* main:
  Update conformance suite commit hash (#23746)
  conformance.py: Collapse the summary paragraph when nothing changed (#23745)
  [ty] Make inferred specializations line up with source types more better (#23715)
  Bump 0.15.5 (#23743)
  [ty] Render all changed diagnostics in conformance.py (#23613)
  [ty] Split deferred checks out of `types/infer/builder.rs` (#23740)
  Discover markdown files by default in preview mode (#23434)
  [ty] Use `HasOptionalDefinition` for `except` handlers (#23739)
  [ty] Fix precedence of `all` selector in TOML configurations (#23723)
  [ty] Make `all` selector case sensitive (#23713)
  [ty] Add a diagnostic if a `TypeVar` is used to specialize a `ParamSpec`, or vice versa (#23738)
  [ty] Override home directory in ty tests (#23724)
  [ty] More type-variable default validation (#23639)
  [ty] Validate bare ParamSpec usage in type annotations, and support stringified ParamSpecs as the first argument to `Callable` (#23625)
  [ty] Add `all` selector to ty.json's `schema` (#23721)
  [ty] Add quotes to related issues links (#23720)
  [ty] Fix panic on incomplete except handlers (#23708)
carljm added a commit that referenced this pull request Mar 16, 2026
* main:
  Update conformance suite commit hash (#23746)
  conformance.py: Collapse the summary paragraph when nothing changed (#23745)
  [ty] Make inferred specializations line up with source types more better (#23715)
  Bump 0.15.5 (#23743)
  [ty] Render all changed diagnostics in conformance.py (#23613)
  [ty] Split deferred checks out of `types/infer/builder.rs` (#23740)
  Discover markdown files by default in preview mode (#23434)
  [ty] Use `HasOptionalDefinition` for `except` handlers (#23739)
  [ty] Fix precedence of `all` selector in TOML configurations (#23723)
  [ty] Make `all` selector case sensitive (#23713)
  [ty] Add a diagnostic if a `TypeVar` is used to specialize a `ParamSpec`, or vice versa (#23738)
  [ty] Override home directory in ty tests (#23724)
  [ty] More type-variable default validation (#23639)
  [ty] Validate bare ParamSpec usage in type annotations, and support stringified ParamSpecs as the first argument to `Callable` (#23625)
  [ty] Add `all` selector to ty.json's `schema` (#23721)
  [ty] Add quotes to related issues links (#23720)
  [ty] Fix panic on incomplete except handlers (#23708)
  Update conformance suite commit hash (#23719)
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.

3 participants