Skip to content

Commit 14b357c

Browse files
committed
Minor doc updates
1 parent 7df1e14 commit 14b357c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

crates/red_knot_python_semantic/src/semantic_index/use_def.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,9 @@ impl<'db> UseDefMapBuilder<'db> {
690690
/// x = 2
691691
/// ```
692692
///
693-
/// Here, `x` is definitely bound if `test2` is always true OR if `test1` is always true. `x` is
694-
/// definitely unbound if `test1` is always false AND `test2` is always false. And `x` is possibly
695-
/// unbound in all other cases.
693+
/// Here, `x` is definitely bound if `test1` is always true OR if `test2` is always true. `x` is
694+
/// definitely unbound if `test1` is always false AND `test2` is always false. `x` is possibly
695+
/// unbound in all other cases. This logic is handled in [`StaticTruthiness::flow_merge`].
696696
///
697697
/// Finally, we also need to consider that a symbol could be definitely bound, even if we can not
698698
/// statically infer the truthiness of a test condition. On such example is:
@@ -714,7 +714,7 @@ where
714714
C: Iterator<Item = BranchingConditionsIterator<'map, 'db>>,
715715
{
716716
let result = conditions_per_binding.fold(StaticTruthiness::no_bindings(), |r, conditions| {
717-
r.merge(&StaticTruthiness::analyze(db, conditions))
717+
r.flow_merge(&StaticTruthiness::analyze(db, conditions))
718718
});
719719

720720
let definitely_unbound = result.any_always_false;

crates/red_knot_python_semantic/src/types/static_truthiness.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ impl StaticTruthiness {
107107
/// of the fields. The reason for this is that we want to draw conclusions like "this symbol can
108108
/// not be bound because one of the branching conditions is always false". We can only draw this
109109
/// conclusion if this is true in both control-flow paths. Similarly, we want to infer that the
110-
/// binding of a symbol is unconditionally visible, if all branching conditions are known to be
111-
/// statically true. It is enough if this is the case for *any* of the control-flow paths. Other
112-
/// control flow paths will not be taken if this is the case.
113-
pub(crate) fn merge(self, other: &Self) -> Self {
110+
/// binding of a symbol is unconditionally visible if all branching conditions are known to be
111+
/// statically true. It is enough if this is the case for either of the two control-flow paths.
112+
/// The other paths can not be taken if this is the case.
113+
pub(crate) fn flow_merge(self, other: &Self) -> Self {
114114
Self {
115115
any_always_false: self.any_always_false && other.any_always_false,
116116
all_always_true: self.all_always_true || other.all_always_true,

0 commit comments

Comments
 (0)