Expand description
Predicates are Python expressions whose runtime values can affect type inference.
We currently use predicates in two places:
- Narrowing constraints constrain the type of a binding that is visible at a particular use.
- Reachability constraints determine the static reachability of a binding, and the reachability of a statement or expression.
Structs§
- Callable
AndCall Expr - Class
Pattern Keyword Predicate Kind - Class
Pattern Predicate Kind - Structural details for a class pattern.
- Mapping
Pattern Entry Predicate Kind - Mapping
Pattern Predicate Kind - Structural details for a mapping pattern.
- Pattern
Predicate - Predicate
- Scoped
Predicate Id - Sequence
Pattern Predicate Kind - Structural details for sequence patterns that affect narrowing and reachability.
- Star
Import Placeholder Predicate - A “placeholder predicate” that is used to model the fact that the boundness of a (possible)
definition or declaration caused by a
*import cannot be fully determined until type- inference time. This is essentially the same as a standard reachability constraint, so we reuse thePredicateinfrastructure to model it. - Subject
Element Pattern Predicate - A pattern predicate applied to one expression in a sequence-display subject.
Enums§
- Pattern
Predicate Kind - Pattern structure used for type narrowing, static reachability, and inferring the types of names bound by a successful match.
- Predicate
Node