Skip to content

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented May 16, 2024

Type of Changes

Type
🐛 Bug fix

Description

Don't emit typevar-name-incorrect-variance warnings for PEP 695 style TypeVars.
The variance is inferred automatically by the type checker.
Adding _co or _contra suffix can help to reason about TypeVar.

Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.84%. Comparing base (7521eb1) to head (40b43ba).
Report is 177 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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              
Files Coverage Δ
pylint/checkers/base/name_checker/checker.py 98.64% <100.00%> (+0.01%) ⬆️

... and 7 files with indirect coverage changes

Copy link
Contributor

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit 40b43ba

Copy link
Collaborator

@DanielNoord DanielNoord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

name_arg = args[0].value

if variance == TypeVarVariance.double_variant:
if variance == TypeVarVariance.inferred:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if variance == TypeVarVariance.inferred:
if variance is TypeVarVariance.inferred:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All other comparisons with TypeVarVariance also use the equals sign.
Let's change it when we implement #5356, maybe?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants