-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Prefer declared type of generic classes #21070
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
cf8b71b to
c563650
Compare
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
c563650 to
fdbb426
Compare
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-assignment |
2 | 1 | 0 |
invalid-argument-type |
0 | 2 | 0 |
index-out-of-bounds |
0 | 1 | 0 |
invalid-return-type |
0 | 0 | 1 |
unused-ignore-comment |
0 | 1 | 0 |
| Total | 2 | 5 | 1 |
|
I'm not sure if we should restrict this change to invariant generics. It seems reasonable to use |
|
@ibraheemdev Is this blocked? What's keeping it in draft? |
CodSpeed Performance ReportMerging #21070 will not alter performanceComparing Summary
Footnotes
|
2f4a925 to
0ee0e3f
Compare
…1165) ## Summary The solver is currently order-dependent, and will choose a supertype over the exact type if it appears earlier in the list of constraints. We could be smarter and try to choose the most precise subtype, but I imagine this is something the new constraint solver will fix anyways, and this fixes the issue showing up on #21070.
0ee0e3f to
2f4dcbf
Compare
|
The ecosystem changes all seem correct. |
|
Superceded by #21210. |
Summary
Extends #20927 to generic call inference, preferring the declared type of generic classes:
Part of astral-sh/ty#136.