-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Always infer the submodule literal for submodule attribute-access, even when we emit a diagnostic #21619
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
base: main
Are you sure you want to change the base?
Conversation
…s, even when we emit a diagnostic
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
| # error: [possibly-missing-attribute] "Submodule `submodule` may not be available" | ||
| reveal_type(mypackage.submodule.nested) # revealed: Unknown | ||
| # error: [possibly-missing-attribute] "Submodule `nested` may not be available" | ||
| reveal_type(mypackage.submodule.nested) # revealed: <module 'mypackage.submodule.nested'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fact that we now emit two diagnostics on this line (rather than one previously) makes me pretty nervous about this. Let's see what the ecosystem says, but something like <module 'mypackage.submodule'> & Any might be better for the inferred type of mypackage.submodule; then (in theory) we wouldn't emit the second diagnostic
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
possibly-missing-attribute |
202 | 25 | 0 |
invalid-argument-type |
71 | 0 | 1 |
unresolved-attribute |
17 | 16 | 0 |
invalid-assignment |
9 | 0 | 0 |
invalid-key |
4 | 0 | 0 |
unsupported-operator |
3 | 0 | 1 |
invalid-await |
3 | 0 | 0 |
unused-ignore-comment |
0 | 3 | 0 |
no-matching-overload |
2 | 0 | 0 |
deprecated |
1 | 0 | 0 |
invalid-method-override |
1 | 0 | 0 |
invalid-parameter-default |
1 | 0 | 0 |
missing-typed-dict-key |
1 | 0 | 0 |
non-subscriptable |
1 | 0 | 0 |
| Total | 316 | 44 | 2 |
|
Taking over this PR for Alex. |
|
Some thoughts: this branch means that you can get three separate |
|
Horribly aware of how much "what if x AND y works well" haunts everything so just spinning that up here in parallel: #21654 |
Summary
Closes astral-sh/ty#1623
Test Plan
mdtests updated