Improve generics handling in term search

This commit is contained in:
Tavo Annus 2024-02-25 16:50:34 +02:00
parent 1d3558bfe1
commit 8bd30e9b3f
6 changed files with 136 additions and 73 deletions

View file

@ -3856,6 +3856,11 @@ impl Type {
Type { env: ty.env, ty: TyBuilder::slice(ty.ty) }
}
pub fn new_tuple(krate: CrateId, tys: &[Type]) -> Type {
let tys = tys.iter().map(|it| it.ty.clone());
Type { env: TraitEnvironment::empty(krate), ty: TyBuilder::tuple_with(tys) }
}
pub fn is_unit(&self) -> bool {
matches!(self.ty.kind(Interner), TyKind::Tuple(0, ..))
}