aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorChetan Khilosiya <[email protected]>2021-03-15 19:46:59 +0000
committerChetan Khilosiya <[email protected]>2021-03-15 19:46:59 +0000
commit714836959be857e2fbd9c497974055deb2a91f9b (patch)
treea91fd0e433d735446727ba85b62f7345b4da0eb8 /crates/hir
parentc0a2b4e826e1da20d3cfa8c279fcdffa24f32a7d (diff)
7709: Added the check for return type of len function.
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index c5161dadd..1a1454068 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1631,6 +1631,13 @@ impl Type {
1631 matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..)) 1631 matches!(self.ty.value.interned(&Interner), TyKind::Ref(hir_ty::Mutability::Mut, ..))
1632 } 1632 }
1633 1633
1634 pub fn is_usize(&self) -> bool {
1635 matches!(
1636 self.ty.value.interned(&Interner),
1637 TyKind::Scalar(Scalar::Uint(hir_ty::primitive::UintTy::Usize))
1638 )
1639 }
1640
1634 pub fn remove_ref(&self) -> Option<Type> { 1641 pub fn remove_ref(&self) -> Option<Type> {
1635 match &self.ty.value.interned(&Interner) { 1642 match &self.ty.value.interned(&Interner) {
1636 TyKind::Ref(.., ty) => Some(self.derived(ty.clone())), 1643 TyKind::Ref(.., ty) => Some(self.derived(ty.clone())),