Skip to content

TypeVar bound or constrained to bool, diverging behavior with mypy #6914

Answered by erictraut
Viicos asked this question in Q&A
Discussion options

You must be logged in to vote

Looks like a bug in pyright. You're doing something very unusual here — using literal types as value constraints. Pyright's constraint solver includes some heuristics about when to retain literals and when to widen the type to non-literals. I'm guessing that those heuristics are failing in this case. Please file a bug, and I'll investigate further.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@erictraut
Comment options

Answer selected by Viicos
@Viicos
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants