diff options
author | adamrk <[email protected]> | 2020-09-02 21:33:54 +0100 |
---|---|---|
committer | adamrk <[email protected]> | 2020-09-02 21:33:54 +0100 |
commit | e11cd8fe35fbb4fcaf7859f4cef2dbd94ff7d230 (patch) | |
tree | 151d1188da4ce2a5a41d730bcc64ffd42e5447aa /crates/hir_ty/src | |
parent | d9bb86ad7dfd17543e6e1c9ef184337f828b1027 (diff) |
Remove exposing unification
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/db.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/infer.rs | 13 |
2 files changed, 0 insertions, 16 deletions
diff --git a/crates/hir_ty/src/db.rs b/crates/hir_ty/src/db.rs index 57e60c53b..25cf9eb7f 100644 --- a/crates/hir_ty/src/db.rs +++ b/crates/hir_ty/src/db.rs | |||
@@ -26,9 +26,6 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> { | |||
26 | #[salsa::invoke(crate::infer::infer_query)] | 26 | #[salsa::invoke(crate::infer::infer_query)] |
27 | fn infer_query(&self, def: DefWithBodyId) -> Arc<InferenceResult>; | 27 | fn infer_query(&self, def: DefWithBodyId) -> Arc<InferenceResult>; |
28 | 28 | ||
29 | #[salsa::invoke(crate::infer::can_unify)] | ||
30 | fn can_unify(&self, def: DefWithBodyId, ty1: Ty, ty2: Ty) -> bool; | ||
31 | |||
32 | #[salsa::invoke(crate::lower::ty_query)] | 29 | #[salsa::invoke(crate::lower::ty_query)] |
33 | #[salsa::cycle(crate::lower::ty_recover)] | 30 | #[salsa::cycle(crate::lower::ty_recover)] |
34 | fn ty(&self, def: TyDefId) -> Binders<Ty>; | 31 | fn ty(&self, def: TyDefId) -> Binders<Ty>; |
diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index d461e077b..2db05ae78 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs | |||
@@ -78,19 +78,6 @@ pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer | |||
78 | Arc::new(ctx.resolve_all()) | 78 | Arc::new(ctx.resolve_all()) |
79 | } | 79 | } |
80 | 80 | ||
81 | pub(crate) fn can_unify(db: &dyn HirDatabase, def: DefWithBodyId, ty1: Ty, ty2: Ty) -> bool { | ||
82 | let resolver = def.resolver(db.upcast()); | ||
83 | let mut ctx = InferenceContext::new(db, def, resolver); | ||
84 | |||
85 | let ty1 = ctx.canonicalizer().canonicalize_ty(ty1).value; | ||
86 | let ty2 = ctx.canonicalizer().canonicalize_ty(ty2).value; | ||
87 | let mut kinds = Vec::from(ty1.kinds.to_vec()); | ||
88 | kinds.extend_from_slice(ty2.kinds.as_ref()); | ||
89 | let tys = crate::Canonical::new((ty1.value, ty2.value), kinds); | ||
90 | |||
91 | unify(&tys).is_some() | ||
92 | } | ||
93 | |||
94 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] | 81 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] |
95 | enum ExprOrPatId { | 82 | enum ExprOrPatId { |
96 | ExprId(ExprId), | 83 | ExprId(ExprId), |