-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] display variance on hover over type variables #20900
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 ✅ |
|
6e7a976
to
7cd6fa3
Compare
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.
Thanks!
ed8d157
to
16a097c
Compare
@mtshiba, unfortunately, there are now some merge conflicts. |
## Summary Derived from #20900 Implement `VarianceInferable` for `KnownInstanceType` (especially for `KnownInstanceType::TypeAliasType`). The variance of a type alias matches its value type. In normal usage, type aliases are expanded to value types, so the variance of a type alias can be obtained without implementing this. However, for example, if we want to display the variance when hovering over a type alias, we need to be able to obtain the variance of the type alias itself (cf. #20900). ## Test Plan I couldn't come up with a way to test this in mdtest, so I'm testing it in a test submodule at the end of `types.rs`. I also added a test to `mdtest/generics/pep695/variance.md`, but it passes without the changes in this PR.
Divergence suppression for recursive aliases is addressed in #20969. Please check it out. |
e08b214
to
2dc528c
Compare
This reverts commit 2dc528c.
Summary
Edit: please merge #20924 first
Closes astral-sh/ty#1348
The variance of a type variable is displayed (next to the type) when hovered over.
They are also displayed in the type parameters list.
This is an enhancement to the language server, but also includes some internal additions to
ty_python_semantic
(such as calculating variances for type aliases).Test Plan
New tests in
ty_ide/hover/tests
.