Skip to content

Commit 081f95a

Browse files
AlexWaygoodMichaReiser
authored andcommitted
cache is_redundant_with, not is_subtype_of
1 parent 09ca4e2 commit 081f95a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/ty_python_semantic/src/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,6 @@ impl<'db> Type<'db> {
15091509
/// Return true if this type is a subtype of type `target`.
15101510
///
15111511
/// See [`TypeRelation::Subtyping`] for more details.
1512-
#[salsa::tracked(cycle_fn=is_subtype_of_cycle_recover, cycle_initial=is_subtype_of_cycle_initial, heap_size=ruff_memory_usage::heap_size)]
15131512
pub(crate) fn is_subtype_of(self, db: &'db dyn Db, target: Type<'db>) -> bool {
15141513
self.when_subtype_of(db, target, InferableTypeVars::None)
15151514
.is_always_satisfied()
@@ -1544,6 +1543,7 @@ impl<'db> Type<'db> {
15441543
/// Return `true` if it would be redundant to add `self` to a union that already contains `other`.
15451544
///
15461545
/// See [`TypeRelation::Redundancy`] for more details.
1546+
#[salsa::tracked(cycle_fn=is_redundant_with_cycle_recover, cycle_initial=is_redundant_with_cycle_initial, heap_size=ruff_memory_usage::heap_size)]
15471547
pub(crate) fn is_redundant_with(self, db: &'db dyn Db, other: Type<'db>) -> bool {
15481548
self.has_relation_to(db, other, InferableTypeVars::None, TypeRelation::Redundancy)
15491549
.is_always_satisfied()
@@ -7328,7 +7328,7 @@ impl<'db> VarianceInferable<'db> for Type<'db> {
73287328
}
73297329

73307330
#[allow(clippy::trivially_copy_pass_by_ref)]
7331-
fn is_subtype_of_cycle_recover<'db>(
7331+
fn is_redundant_with_cycle_recover<'db>(
73327332
_db: &'db dyn Db,
73337333
_value: &bool,
73347334
_count: u32,
@@ -7338,7 +7338,7 @@ fn is_subtype_of_cycle_recover<'db>(
73387338
salsa::CycleRecoveryAction::Iterate
73397339
}
73407340

7341-
fn is_subtype_of_cycle_initial<'db>(
7341+
fn is_redundant_with_cycle_initial<'db>(
73427342
_db: &'db dyn Db,
73437343
_subtype: Type<'db>,
73447344
_supertype: Type<'db>,

0 commit comments

Comments
 (0)