fix show variance when hovering over generics #3540#3545
fix show variance when hovering over generics #3540#3545asukaminato0721 wants to merge 1 commit into
Conversation
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
| fn type_parameter_hover_display( | ||
| solver: &AnswersSolver<TransactionHandle<'_>>, | ||
| type_: &Type, | ||
| owner: &Class, |
There was a problem hiding this comment.
can't the type param be owned by a function definition too?
There was a problem hiding this comment.
and perhaps another question is, is it important/useful to display the owner at all? we didn't do it previously, and IDK how much people understand the @ notation, even if Pyright does use it
| "Expected class type parameter hover to show inferred variance, got: {report}" | ||
| ); | ||
| assert!( | ||
| !report.contains("(type parameter) T: T"), |
There was a problem hiding this comment.
our format seems somewhat standardized with the kind of symbol in parentheses in front of the type, i agree that maybe it's redundant, but I wonder if this is introducing inconsistencies
|
@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D106091156. |
Summary
Fixes #3540
now class type-parameter hovers find the owning class, query the existing variance solver, and render
T@Foo (covariant)without the redundant(type parameter) T: ...prefix.Test Plan
add test