explicit return from each arm

This commit is contained in:
Douglas Creager 2025-08-05 14:28:07 -04:00
parent 4dc2ca50ca
commit b8b4a192c7
1 changed files with 15 additions and 1 deletions

View File

@ -180,6 +180,7 @@ impl<'db> ConstraintSetSet<'db> {
| Type::SpecialForm(_) => {
let result = ConstraintSetSet::never();
self.results.insert(ty, result);
return;
}
Type::Union(union) => {
@ -191,6 +192,7 @@ impl<'db> ConstraintSetSet<'db> {
self.result(*element).intersect(db, &sets)
});
self.results.insert(ty, result);
return;
}
Type::Intersection(intersection) => {
@ -273,7 +275,11 @@ impl<'db> ConstraintSetSet<'db> {
return;
}
// TODO: other intersection clauses
// TODO: Do we need to handle non-uniform intersections? For now, assume
// the intersection is not empty.
let result = ConstraintSetSet::never();
self.results.insert(ty, result);
return;
}
Type::TypeVar(typevar) => {
@ -285,10 +291,18 @@ impl<'db> ConstraintSetSet<'db> {
upper: Type::object(db),
};
self.results.insert(ty, constraint.into());
return;
}
_ => todo!(),
}
// Every match arm should explicitly return once it has calculated and memoized a
// result.
#[expect(unreachable_code)]
{
unreachable!();
}
}
}