-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Prefer declared type for invariant collection literals #20927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
6 | 276 | 7 |
possibly-missing-implicit-call |
0 | 56 | 1 |
possibly-missing-attribute |
1 | 38 | 0 |
unsupported-operator |
1 | 31 | 3 |
invalid-assignment |
0 | 24 | 3 |
unresolved-attribute |
15 | 0 | 0 |
non-subscriptable |
0 | 14 | 0 |
unused-ignore-comment |
6 | 1 | 0 |
invalid-return-type |
0 | 1 | 5 |
no-matching-overload |
0 | 6 | 0 |
index-out-of-bounds |
0 | 2 | 0 |
not-iterable |
0 | 2 | 0 |
invalid-await |
0 | 0 | 1 |
redundant-cast |
1 | 0 | 0 |
type-assertion-failure |
0 | 1 | 0 |
| Total | 30 | 452 | 20 |
|
(Retitled the PR because tuples are also collection literals, but those don't look like they're touched by this PR -- a decision which I support!) |
b763bb9 to
ed53e9b
Compare
CodSpeed Performance ReportMerging #20927 will improve performances by 5.14%Comparing Summary
Benchmarks breakdown
Footnotes
|
|
Looks like there are no regressions in the ecosystem report and a lot of clear improvements, so hopefully this is fairly uncontroversial (I also discussed this with @carljm and he agreed). |
* main: [ty] Prefer declared type for invariant collection literals (#20927) [ty] Don't track inferability via different `Type` variants (#20677) [ty] Use declared variable types as bidirectional type context (#20796) [ty] Avoid unnecessarily widening generic specializations (#20875) [ty] Support dataclass-transform `field_specifiers` (#20888) Bump 0.14.1 (#20925) Standardize syntax error construction (#20903) [`pydoclint`] Implement `docstring-extraneous-parameter` (`DOC102`) (#20376) [ty] Fix panic 'missing root' when handling completion request (#20917) [ty] Run file watching tests serial when using nextest (#20918) [ty] Add version hint for failed stdlib attribute accesses (#20909) More CI improvements (#20920) [ty] Check typeshed VERSIONS for parent modules when reporting failed stdlib imports (#20908)
Summary
Prefer the declared type for collection literals, e.g.,
This solves a large part of astral-sh/ty#136 for invariant generics, where respecting the declared type is a lot more important. It also means that annotated dict literals with
dict[_, Any]is a way out of astral-sh/ty#1248.