Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ty] Consolidate retained narrowing constraints#25660

Merged
charliermarsh merged 1 commit into
mainfrom
charlie/consolidate-narrowing-constraint-queries
Jun 5, 2026
Merged

[ty] Consolidate retained narrowing constraints#25660
charliermarsh merged 1 commit into
mainfrom
charlie/consolidate-narrowing-constraint-queries

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

Reachability always requests both positive and negative narrowing constraints for an expression predicate. We currently retain each polarity in a separate Salsa query, even though both queries load the same expression and traverse the same predicate.

This change computes both polarities in one tracked query and returns the pair together to reachability. The positive and negative constraints remain separate, but we avoid retaining duplicate query metadata and arguments.

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

astral-sh-bot Bot commented Jun 5, 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 5, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
flake8 38.64MB 38.59MB -0.11% (44.93kB) ⬇️
trio 98.96MB 98.60MB -0.36% (365.53kB) ⬇️
sphinx 237.91MB 236.61MB -0.55% (1.30MB) ⬇️
prefect 653.76MB 649.99MB -0.58% (3.76MB) ⬇️

Significant changes

Click to expand detailed breakdown

flake8

Name Old New Diff Outcome
all_negative_narrowing_constraints_for_expression 101.76kB 0.00B -100.00% (101.76kB) ⬇️
all_narrowing_constraints_for_expression 105.39kB 169.50kB +60.84% (64.12kB) ⬇️
infer_expression_types_impl 1.03MB 1.02MB -0.46% (4.83kB) ⬇️
infer_definition_types 1.62MB 1.62MB -0.07% (1.09kB) ⬇️
infer_scope_types_impl 844.35kB 843.55kB -0.09% (816.00B) ⬇️
infer_expression_type_impl 115.12kB 114.73kB -0.34% (396.00B) ⬇️
infer_statement_types_impl 42.56kB 42.48kB -0.19% (84.00B) ⬇️
loop_header_reachability 12.46kB 12.40kB -0.47% (60.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 45.75kB 45.73kB -0.05% (24.00B) ⬇️
Type<'db>::member_lookup_with_policy_ 541.01kB 540.99kB -0.00% (24.00B) ⬇️

trio

Name Old New Diff Outcome
all_negative_narrowing_constraints_for_expression 662.71kB 0.00B -100.00% (662.71kB) ⬇️
all_narrowing_constraints_for_expression 696.46kB 1.02MB +49.81% (346.88kB) ⬇️
infer_expression_types_impl 6.74MB 6.71MB -0.48% (32.93kB) ⬇️
infer_definition_types 6.89MB 6.89MB -0.10% (7.22kB) ⬇️
infer_scope_types_impl 4.08MB 4.08MB -0.11% (4.49kB) ⬇️
infer_expression_type_impl 1.47MB 1.47MB -0.28% (4.15kB) ⬇️
loop_header_reachability 135.36kB 135.02kB -0.25% (348.00B) ⬇️
Type<'db>::member_lookup_with_policy_ 1.88MB 1.88MB -0.01% (204.00B) ⬇️
infer_statement_types_impl 50.81kB 50.67kB -0.28% (144.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 126.30kB 126.19kB -0.09% (120.00B) ⬇️
function_known_decorators 297.10kB 297.05kB -0.02% (48.00B) ⬇️
infer_deferred_types 2.05MB 2.05MB -0.00% (48.00B) ⬇️
infer_unpack_types 165.48kB 165.46kB -0.01% (12.00B) ⬇️
overloads_and_implementation_inner 327.47kB 327.46kB -0.00% (12.00B) ⬇️

sphinx

Name Old New Diff Outcome
all_negative_narrowing_constraints_for_expression 2.61MB 0.00B -100.00% (2.61MB) ⬇️
all_narrowing_constraints_for_expression 2.69MB 4.22MB +57.10% (1.54MB) ⬇️
infer_expression_types_impl 20.84MB 20.68MB -0.77% (164.85kB) ⬇️
infer_definition_types 21.31MB 21.27MB -0.20% (42.66kB) ⬇️
infer_scope_types_impl 13.21MB 13.18MB -0.17% (23.03kB) ⬇️
infer_expression_type_impl 2.94MB 2.94MB -0.17% (5.23kB) ⬇️
infer_statement_types_impl 489.35kB 487.46kB -0.39% (1.89kB) ⬇️
loop_header_reachability 357.28kB 355.93kB -0.38% (1.35kB) ⬇️
Type<'db>::member_lookup_with_policy_ 7.04MB 7.04MB -0.01% (600.00B) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 708.18kB 708.04kB -0.02% (144.00B) ⬇️
infer_unpack_types 472.25kB 472.23kB -0.00% (24.00B) ⬇️

prefect

Name Old New Diff Outcome
all_negative_narrowing_constraints_for_expression 8.26MB 0.00B -100.00% (8.26MB) ⬇️
all_narrowing_constraints_for_expression 8.44MB 13.44MB +59.10% (4.99MB) ⬇️
infer_expression_types_impl 59.17MB 58.82MB -0.60% (361.56kB) ⬇️
infer_definition_types 82.05MB 81.97MB -0.10% (81.26kB) ⬇️
infer_scope_types_impl 50.36MB 50.32MB -0.09% (46.83kB) ⬇️
infer_expression_type_impl 8.35MB 8.33MB -0.13% (10.93kB) ⬇️
infer_statement_types_impl 955.46kB 953.79kB -0.18% (1.68kB) ⬇️
loop_header_reachability 465.77kB 464.50kB -0.27% (1.27kB) ⬇️
Type<'db>::member_lookup_with_policy_ 16.69MB 16.69MB -0.01% (1.23kB) ⬇️
StaticClassLiteral<'db>::implicit_attribute_inner_ 1.04MB 1.04MB -0.06% (696.00B) ⬇️
infer_unpack_types 1.09MB 1.09MB -0.03% (348.00B) ⬇️
infer_deferred_types 10.27MB 10.27MB -0.00% (48.00B) ⬇️
function_known_decorators 4.17MB 4.17MB -0.00% (36.00B) ⬇️
is_redundant_with_impl 2.12MB 2.12MB -0.00% (24.00B) ⬇️

@charliermarsh charliermarsh added the performance Potential performance improvement label Jun 5, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 5, 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 June 5, 2026 15:08
@charliermarsh charliermarsh marked this pull request as draft June 5, 2026 15:17
@charliermarsh charliermarsh marked this pull request as ready for review June 5, 2026 15:24
@charliermarsh charliermarsh merged commit 96a8880 into main Jun 5, 2026
59 checks passed
@charliermarsh charliermarsh deleted the charlie/consolidate-narrowing-constraint-queries branch June 5, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Potential performance improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants