-
Notifications
You must be signed in to change notification settings - Fork 23
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
Detect multiple Literal
members in a union
#112
Conversation
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 good! Just one nit.
Typeshed PR here: python/typeshed#6984 |
Python 3.7 and 3.8 fail the CI because they don't have I added
We should be prepared to handle Literals containing "literal ints, byte and unicode strings, bools, Enum values and None", according to PEP 586. |
Ugh bytes and enums. Great. |
Thinking about it a bit more, I think the logic can be quite simple: if it's a |
Yeah, mypy can reliably complain if a user puts in an incompatible value, we just need to handle the formatting |
I added one more test case, because I wasn't sure whether it would work in different Python versions. It seems to be fine though. |
Thanks! I was having my supper :) |
Shall I hold off on merging until #113 is in? |
I think I'll merge this first and fix the conflicts in my PR then. |
Detect multiple `Literal` values in a union Co-authored-by: Akuli <[email protected]>
Thanks for the quick implementation here @AlexWaygood! |
Pleasure 😀 |
Fix #110