Detect multiple Literal members in a union#112
Conversation
Akuli
left a comment
There was a problem hiding this comment.
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 <akuviljanen17@gmail.com>
|
Thanks for the quick implementation here @AlexWaygood! |
Pleasure 😀 |
Fix #110