Skip to content

[ty] Avoid retaining duplicate function signatures#25609

Merged
charliermarsh merged 1 commit into
mainfrom
charlie/compact-function-signatures
Jun 3, 2026
Merged

[ty] Avoid retaining duplicate function signatures#25609
charliermarsh merged 1 commit into
mainfrom
charlie/compact-function-signatures

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

A FunctionType currently retains a potentially updated public callable signature and a potentially updated signature for its last definition. For ordinary functions and overload-only functions, the last definition is already part of the public callable signature; only an overloaded function with a separate implementation needs an additional retained signature.

Represent the additional field as an implementation-only signature. Ordinary functions and overload-only functions recover their last-definition signature from the updated public signature, while overloaded functions with a separate implementation continue to retain that implementation signature explicitly.

@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Jun 3, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 3, 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 92.13%. The percentage of expected errors that received a diagnostic held steady at 87.18%. The number of fully passing files held steady at 92/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 41.84MB 41.72MB -0.28% (121.14kB) ⬇️
trio 104.96MB 104.57MB -0.37% (402.09kB) ⬇️
sphinx 249.93MB 249.34MB -0.24% (602.79kB) ⬇️
prefect 677.46MB 675.92MB -0.23% (1.55MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
FunctionType<'db>::last_definition_signature_ 63.62kB 0.00B -100.00% (63.62kB) ⬇️
FunctionType 494.22kB 431.56kB -12.68% (62.66kB) ⬇️
Type<'db>::apply_specialization_ 212.13kB 217.52kB +2.54% (5.39kB) ⬇️
function_known_decorators 155.82kB 155.73kB -0.06% (96.00B) ⬇️
infer_definition_types 1.65MB 1.65MB -0.00% (84.00B) ⬇️
lookup_dunder_new_inner 19.57kB 19.54kB -0.12% (24.00B) ⬇️
infer_scope_types_impl 859.77kB 859.76kB -0.00% (12.00B) ⬇️
Type<'db>::member_lookup_with_policy_ 575.48kB 575.47kB -0.00% (12.00B) ⬇️
Type<'db>::class_member_with_policy_ 597.42kB 597.41kB -0.00% (12.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 311.96kB 311.95kB -0.00% (12.00B) ⬇️

trio

Name Old New Diff Outcome
FunctionType<'db>::last_definition_signature_ 253.95kB 16.79kB -93.39% (237.16kB) ⬇️
FunctionType 1.58MB 1.40MB -11.21% (181.33kB) ⬇️
Type<'db>::apply_specialization_ 630.69kB 647.66kB +2.69% (16.97kB) ⬇️
infer_definition_types 6.97MB 6.97MB -0.01% (744.00B) ⬇️
Type<'db>::class_member_with_policy_ 2.02MB 2.02MB +0.01% (276.00B) ⬇️
infer_expression_types_impl 6.89MB 6.89MB -0.00% (108.00B) ⬇️
Type<'db>::expand_eagerly__ 3.36kB 3.46kB +2.79% (96.00B) ⬇️
infer_scope_types_impl 4.12MB 4.12MB -0.00% (48.00B) ⬇️
infer_expression_type_impl 1.50MB 1.50MB -0.00% (48.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 742.51kB 742.49kB -0.00% (24.00B) ⬇️
lookup_dunder_new_inner 54.21kB 54.22kB +0.02% (12.00B) ⬇️
infer_unpack_types 172.61kB 172.60kB -0.01% (12.00B) ⬇️
Type<'db>::member_lookup_with_policy_ 1.95MB 1.95MB +0.00% (12.00B) ⬇️

sphinx

Name Old New Diff Outcome
FunctionType 3.57MB 3.18MB -10.84% (395.89kB) ⬇️
FunctionType<'db>::last_definition_signature_ 246.14kB 2.98kB -98.79% (243.16kB) ⬇️
Type<'db>::apply_specialization_ 1.74MB 1.78MB +2.06% (36.74kB) ⬇️
infer_definition_types 21.68MB 21.68MB -0.00% (1020.00B) ⬇️
Type<'db>::class_member_with_policy_ 7.96MB 7.96MB +0.01% (840.00B) ⬇️
infer_scope_types_impl 13.35MB 13.35MB -0.00% (120.00B) ⬇️
FunctionType<'db>::last_definition_raw_signature_ 3.05MB 3.05MB -0.00% (72.00B) ⬇️
lookup_dunder_new_inner 120.47kB 120.43kB -0.03% (36.00B) ⬇️
infer_expression_types_impl 21.51MB 21.51MB -0.00% (36.00B) ⬇️
Type<'db>::member_lookup_with_policy_ 7.30MB 7.30MB +0.00% (24.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 2.39MB 2.39MB -0.00% (24.00B) ⬇️
FunctionType<'db>::signature_ 2.60MB 2.60MB -0.00% (24.00B) ⬇️
infer_deferred_types 4.69MB 4.69MB -0.00% (12.00B) ⬇️

prefect

Name Old New Diff Outcome
FunctionType 10.07MB 9.21MB -8.56% (883.11kB) ⬇️
FunctionType<'db>::last_definition_signature_ 833.33kB 55.71kB -93.31% (777.62kB) ⬇️
Type<'db>::apply_specialization_ 3.58MB 3.66MB +2.26% (82.79kB) ⬇️
infer_definition_types 83.01MB 83.01MB -0.00% (3.50kB) ⬇️
function_known_decorators 4.28MB 4.27MB -0.05% (1.98kB) ⬇️
infer_expression_types_impl 60.15MB 60.14MB -0.00% (780.00B) ⬇️
Type<'db>::class_member_with_policy_ 18.45MB 18.45MB +0.00% (744.00B) ⬇️
infer_scope_types_impl 50.53MB 50.53MB -0.00% (516.00B) ⬇️
infer_expression_type_impl 8.38MB 8.38MB -0.00% (288.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 7.05MB 7.05MB -0.00% (168.00B) ⬇️
Type<'db>::member_lookup_with_policy_ 17.26MB 17.26MB -0.00% (156.00B) ⬇️
infer_deferred_types 10.21MB 10.21MB -0.00% (108.00B) ⬇️
infer_statement_types_impl 1.02MB 1.02MB -0.01% (72.00B) ⬇️
lookup_dunder_new_inner 313.30kB 313.36kB +0.02% (60.00B) ⬇️
all_negative_narrowing_constraints_for_expression 8.37MB 8.37MB -0.00% (48.00B) ⬇️
... 4 more

@astral-sh-bot

astral-sh-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Full report with detailed diff (timing results)

@charliermarsh charliermarsh force-pushed the charlie/compact-function-signatures branch from 2565513 to 2206fd9 Compare June 3, 2026 19:53
@charliermarsh charliermarsh marked this pull request as ready for review June 3, 2026 20:05
@charliermarsh charliermarsh merged commit a8a0614 into main Jun 3, 2026
59 checks passed
@charliermarsh charliermarsh deleted the charlie/compact-function-signatures branch June 3, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants