Skip to content

AlwaysTruthy | bool is equivalent to AlwaysTruthy | Literal[False] #216

@AlexWaygood

Description

@AlexWaygood

This equivalence follows from the fact that bool is equivalent to Literal[True] | Literal[False] and from the fact that Literal[True] is a subtype of AlwaysTruthy. A proof of the fact that these are equivalent can be found in the fact that there are two ways that the union Literal[False] | Literal[True] | AlwaysTruthy could be validly simplified:

  • (Literal[False] | Literal[True]) | AlwaysTruthy -> bool | AlwaysTruthy
  • Literal[False] | (Literal[True] | AlwaysTruthy) -> Literal[False] | AlwaysTruthy

We don't currently recognise that AlwaysTruthy | bool and AlwaysTruthy | Literal[False] are equivalent types; this should be fixed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingset-theoretic typesunions, intersections and more

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions