7709: Added the check for return type of len function.
This commit is contained in:
@@ -1631,6 +1631,13 @@ impl Type {
|
||||
matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..))
|
||||
}
|
||||
|
||||
pub fn is_usize(&self) -> bool {
|
||||
matches!(
|
||||
self.ty.value.interned(&Interner),
|
||||
TyKind::Scalar(Scalar::Uint(hir_ty::primitive::UintTy::Usize))
|
||||
)
|
||||
}
|
||||
|
||||
pub fn remove_ref(&self) -> Option<Type> {
|
||||
match &self.ty.value.interned(&Interner) {
|
||||
TyKind::Ref(.., ty) => Some(self.derived(ty.clone())),
|
||||
|
||||
Reference in New Issue
Block a user