Repository navigation
Don't emit incorrect-variance for type parameters (PEP 695) - #9638
Merged
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9638 +/- ##
==========================================
+ Coverage 95.82% 95.84% +0.01%
==========================================
Files 173 174 +1
Lines 18835 18896 +61
==========================================
+ Hits 18049 18110 +61
Misses 786 786
|
Contributor
|
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 40b43ba |
DanielNoord
approved these changes
May 17, 2024
| name_arg = args[0].value | ||
|
|
||
| if variance == TypeVarVariance.double_variant: | ||
| if variance == TypeVarVariance.inferred: |
Collaborator
There was a problem hiding this comment.
Suggested change
| if variance == TypeVarVariance.inferred: | |
| if variance is TypeVarVariance.inferred: |
Member
Author
There was a problem hiding this comment.
All other comparisons with TypeVarVariance also use the equals sign.
Let's change it when we implement #5356, maybe?
github-actions Bot
pushed a commit
that referenced
this pull request
May 17, 2024
(cherry picked from commit fbc1ed3)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Changes
Description
Don't emit
typevar-name-incorrect-variancewarnings for PEP 695 style TypeVars.The variance is inferred automatically by the type checker.
Adding
_coor_contrasuffix can help to reason about TypeVar.