review comments

This commit is contained in:
Carl Meyer 2025-12-11 09:24:27 -08:00
parent e7ccc073d1
commit ec113ef692
No known key found for this signature in database
GPG Key ID: 2D1FB7916A52E121
1 changed files with 10 additions and 9 deletions

View File

@ -912,18 +912,19 @@ impl<'db> Type<'db> {
previous: Self,
cycle: &salsa::Cycle,
) -> Self {
// Avoid unioning two class-literals or generic-aliases together; this union will never
// Avoid unioning two generic aliases of the same class together; this union will never
// simplify and is likely to cause downstream problems. This introduces the theoretical
// possibility of cycle oscillation involving such types (because we are not strictly
// widening the type on each iteration), but so far we have not seen an example of that.
let base_ty = if (self.is_class_literal() && previous.is_class_literal())
|| (self.is_generic_alias() && previous.is_generic_alias())
{
self
} else {
UnionType::from_elements_cycle_recovery(db, [self, previous])
};
base_ty.recursive_type_normalized(db, cycle)
match (previous, self) {
(Type::GenericAlias(prev_alias), Type::GenericAlias(curr_alias))
if prev_alias.origin(db) == curr_alias.origin(db) =>
{
self
}
_ => UnionType::from_elements_cycle_recovery(db, [self, previous]),
}
.recursive_type_normalized(db, cycle)
}
fn is_none(&self, db: &'db dyn Db) -> bool {