Skip to content

[ty] Extract relation module from types.rs#22232

Merged
MichaReiser merged 1 commit intomainfrom
micha/relation-module
Jan 5, 2026
Merged

[ty] Extract relation module from types.rs#22232
MichaReiser merged 1 commit intomainfrom
micha/relation-module

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Dec 28, 2025

Summary

This PR introduces a new relation.rs module that implements the type relation (anything TypeRelation) methods on Type.

This reduces the size of types.rs by about 2.5k lines.

A follow-up change could be to extract all type-var-related code into a type_var module.

I started on this because I had a very slim hope that reducing the size of types.rs would help compile times... It doesn't do in any meaningful way.

Test Plan

cargo

@MichaReiser MichaReiser added the internal An internal refactor or improvement label Dec 28, 2025
@MichaReiser MichaReiser requested a review from carljm as a code owner December 28, 2025 08:51
@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label Dec 28, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 28, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 28, 2025

mypy_primer results

Changes were detected when running on open source projects
tornado (https://github.com/tornadoweb/tornado)
- tornado/gen.py:255:62: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `None | Awaitable[Unknown] | list[Awaitable[Unknown]] | dict[Any, Awaitable[Unknown]] | Future[Unknown]`, found `_T@next | _T@next | _VT@next`
+ tornado/gen.py:255:62: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `None | Awaitable[Unknown] | list[Awaitable[Unknown]] | dict[Any, Awaitable[Unknown]] | Future[Unknown]`, found `_T@next | _VT@next | _T@next`

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
+ src/scikit_build_core/build/wheel.py:98:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 47 diagnostics
+ Found 48 diagnostics

static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/bus.py:675:16: error[invalid-return-type] Return type does not match returned value: expected `InterGetItemILocReduces[Bus[Any], object_]`, found `InterGetItemILocReduces[Top[Index[Any]] | TypeBlocks | Top[Bus[Any]] | ... omitted 6 union elements, object_ | Self@iloc]`
+ static_frame/core/bus.py:675:16: error[invalid-return-type] Return type does not match returned value: expected `InterGetItemILocReduces[Bus[Any], object_]`, found `InterGetItemILocReduces[Top[Index[Any]] | TypeBlocks | Top[Bus[Any]] | ... omitted 6 union elements, generic[object]]`
- static_frame/core/series.py:772:16: error[invalid-return-type] Return type does not match returned value: expected `InterGetItemILocReduces[Series[Any, Any], TVDtype@Series]`, found `InterGetItemILocReduces[Series[Any, Any] | TypeBlocks | Batch | ... omitted 6 union elements, generic[object]]`
+ static_frame/core/series.py:772:16: error[invalid-return-type] Return type does not match returned value: expected `InterGetItemILocReduces[Series[Any, Any], TVDtype@Series]`, found `InterGetItemILocReduces[Top[Index[Any]] | TypeBlocks | Top[Bus[Any]] | ... omitted 6 union elements, generic[object]]`
- static_frame/core/series.py:4072:16: error[invalid-return-type] Return type does not match returned value: expected `InterGetItemILocReduces[SeriesHE[Any, Any], TVDtype@SeriesHE]`, found `InterGetItemILocReduces[Bottom[Series[Any, Any]] | TypeBlocks | Batch | ... omitted 7 union elements, generic[object]]`
+ static_frame/core/series.py:4072:16: error[invalid-return-type] Return type does not match returned value: expected `InterGetItemILocReduces[SeriesHE[Any, Any], TVDtype@SeriesHE]`, found `InterGetItemILocReduces[Top[Index[Any]] | TypeBlocks | Top[Bus[Any]] | ... omitted 7 union elements, generic[object]]`

No memory usage changes detected ✅

@MichaReiser MichaReiser force-pushed the micha/relation-module branch from daf4ed4 to 018440c Compare January 5, 2026 13:01
@MichaReiser MichaReiser force-pushed the micha/relation-module branch from 018440c to 8b5caa5 Compare January 5, 2026 13:12
@MichaReiser MichaReiser enabled auto-merge (squash) January 5, 2026 13:13
@MichaReiser MichaReiser merged commit 24dd149 into main Jan 5, 2026
47 checks passed
@MichaReiser MichaReiser deleted the micha/relation-module branch January 5, 2026 13:16
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 ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants