[ty] [experiment] improve narrowing from conditional terminals#23172
[ty] [experiment] improve narrowing from conditional terminals#23172mtshiba wants to merge 5 commits intoastral-sh:mainfrom
Conversation
Typing conformance resultsNo changes detected ✅ |
CodSpeed Performance ReportMerging this PR will degrade performance by 16.1%Comparing Summary
Performance Changes
Footnotes
|
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
possibly-missing-attribute |
22 | 77 | 129 |
invalid-argument-type |
13 | 79 | 68 |
invalid-return-type |
3 | 27 | 14 |
unresolved-attribute |
1 | 13 | 13 |
invalid-assignment |
1 | 11 | 13 |
not-subscriptable |
8 | 15 | 0 |
unsupported-operator |
1 | 11 | 11 |
no-matching-overload |
7 | 11 | 0 |
unresolved-reference |
0 | 10 | 0 |
not-iterable |
0 | 5 | 3 |
call-non-callable |
0 | 7 | 0 |
unused-type-ignore-comment |
5 | 2 | 0 |
type-assertion-failure |
0 | 0 | 2 |
invalid-type-form |
0 | 1 | 0 |
redundant-cast |
0 | 1 | 0 |
| Total | 61 | 270 | 253 |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownflake8
prefect
sphinx
trio
|
|
The approach in #23109 does not require an artificial upper limit and seems more sophisticated. But cases like |
Co-Authored-By: Alex Gaynor <alex.gaynor@gmail.com>
Summary
This is an experiment. What this PR is trying to fix is already covered by #23109, but I started working on it without realizing it... (because it was needed for #23136). However, since it uses a different approach than #23109, I'll look at the performance differences. The scope of changes seems to be smaller, but the display of union types seems to change significantly. Additional work may be needed to minimize the display changes.
The core change in this PR is that when merging identical bindings in
Bindings::merge, instead of simply combining the bindings into one, it tries to keep the two bindings as separate as possible.Fixes astral-sh/ty#690
Test Plan
mdtest updated