-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Improve type-name-incorrect-variance
message
#5658
Improve type-name-incorrect-variance
message
#5658
Conversation
I think something went wrong with GitHub Actions. |
What happens in the event that a variable is marked as both covariant and contravariant? |
PR Check ResultsEcosystemℹ️ ecosystem check detected changes. (+2, -2, 0 error(s)) disnake (+2, -2)
- disnake/ext/commands/base_core.py:39:38: PLC0105 `TypeVar` name "ApplicationCommandInteractionT" does not match variance + disnake/ext/commands/base_core.py:39:38: PLC0105 `TypeVar` name "ApplicationCommandInteractionT" does not reflect its covariance; consider renaming it to "ApplicationCommandInteractionT_co" - disnake/i18n.py:53:11: PLC0105 `TypeVar` name "StringT" does not match variance + disnake/i18n.py:53:11: PLC0105 `TypeVar` name "StringT" does not reflect its covariance; consider renaming it to "StringT_co"
BenchmarkLinux
Windows
|
Currently, it ignores anything that is both covariant and contravariant. However, looking at the Pylint implementation, it emits
It should be simple to emit a similar generic message. Do you think it's better to ignore invalid bivariant types or to emit a generic message instead? |
Hmm, I think ignoring them is fine actually, since this diagnostic can't actually be satisfied by renaming the variable. |
) ## Summary #5658 didn't actually ignore bivariate types in some all cases (sorry about that). This PR fixes that and adds bivariate types to the test fixture. ## Test Plan `cargo test`
Summary
Change the
type-name-incorrect-variance
diagnostic message to include the detected variance and a name change recommendation. For example,Related to #5651.
Test Plan
cargo test