[red-knot] Rename constraint to predicate (#16382)

In https://github.com/astral-sh/ruff/pull/16306#discussion_r1966290700,
@carljm pointed out that #16306 introduced a terminology problem, with
too many things called a "constraint". This is a follow-up PR that
renames `Constraint` to `Predicate` to hopefully clear things up a bit.
So now we have that:

- a _predicate_ is a Python expression that might influence type
inference
- a _narrowing constraint_ is a list of predicates that constraint the
type of a binding that is visible at a use
- a _visibility constraint_ is a ternary formula of predicates that
define whether a binding is visible or a statement is reachable

This is a pure renaming, with no behavioral changes.
This commit is contained in:
Douglas Creager 2025-02-25 14:52:40 -05:00 committed by GitHub
parent 86b01d2d3c
commit b39a4ad01d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 327 additions and 314 deletions

View file

@ -25,10 +25,10 @@ use crate::Db;
pub mod ast_ids;
pub mod attribute_assignment;
mod builder;
pub(crate) mod constraint;
pub mod definition;
pub mod expression;
mod narrowing_constraints;
pub(crate) mod predicate;
pub mod symbol;
mod use_def;
mod visibility_constraints;