-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix attrs.evolve on bound TypeVar #15022
Fix attrs.evolve on bound TypeVar #15022
Conversation
3a8b535
to
dfd155b
Compare
This comment has been minimized.
This comment has been minimized.
5088b60
to
a3364f1
Compare
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.
Looks great, thank you!
@hauntsaninja thinking about it, is there an existing facility I can use here, so that I could also support unions? Feels like checking |
Good question, if you can get something from mypy.checkmember to work for you that's probably the way to go |
That was my first thought, but checkmember is complex and probably ill-fitted for anything that's not true member access. I thought I'd need some kind of TypeVisitor that'll list the types, then iterate over the types and "union" the signatures, e.g.
|
Fixes the error on the last line of this example:
Since
T
is bounded byA
, we know it can be treated asA
.