diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-23 12:03:18 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-23 12:03:18 +0100 |
commit | 0ec4ce1e9bceb2d7b0833de2ab59e2cd583e01ec (patch) | |
tree | 56ee0561e7f7240a0571e0c1be484c83bf985541 /crates/hir | |
parent | 808ebe4b865176dcc394ea4adcb3a24f60955734 (diff) | |
parent | 34a3bc4196db302ea5b31c51b6d555336965be5f (diff) |
Merge #8938
8938: internal: Fix #8931 r=flodiebold a=flodiebold
- and add some better checking for similar bugs
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/hir/src/semantics.rs | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 52d72c3c5..800101c91 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -2053,7 +2053,7 @@ impl Type { | |||
2053 | name: Option<&Name>, | 2053 | name: Option<&Name>, |
2054 | mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>, | 2054 | mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>, |
2055 | ) -> Option<T> { | 2055 | ) -> Option<T> { |
2056 | let canonical = hir_ty::replace_errors_with_variables(self.ty.clone()); | 2056 | let canonical = hir_ty::replace_errors_with_variables(&self.ty); |
2057 | 2057 | ||
2058 | let env = self.env.clone(); | 2058 | let env = self.env.clone(); |
2059 | let krate = krate.id; | 2059 | let krate = krate.id; |
@@ -2222,7 +2222,7 @@ impl Type { | |||
2222 | } | 2222 | } |
2223 | 2223 | ||
2224 | pub fn could_unify_with(&self, db: &dyn HirDatabase, other: &Type) -> bool { | 2224 | pub fn could_unify_with(&self, db: &dyn HirDatabase, other: &Type) -> bool { |
2225 | let tys = hir_ty::replace_errors_with_variables((self.ty.clone(), other.ty.clone())); | 2225 | let tys = hir_ty::replace_errors_with_variables(&(self.ty.clone(), other.ty.clone())); |
2226 | could_unify(db, self.env.clone(), &tys) | 2226 | could_unify(db, self.env.clone(), &tys) |
2227 | } | 2227 | } |
2228 | } | 2228 | } |
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 38bd376bc..1b5064b5a 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs | |||
@@ -505,9 +505,10 @@ impl<'db> SemanticsImpl<'db> { | |||
505 | } | 505 | } |
506 | 506 | ||
507 | fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> { | 507 | fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> { |
508 | // FIXME: this erases Substs | 508 | // FIXME: this erases Substs, we should instead record the correct |
509 | // substitution during inference and use that | ||
509 | let func = self.resolve_method_call(call)?; | 510 | let func = self.resolve_method_call(call)?; |
510 | let (ty, _) = self.db.value_ty(func.into()).into_value_and_skipped_binders(); | 511 | let ty = hir_ty::TyBuilder::value_ty(self.db, func.into()).fill_with_unknown().build(); |
511 | let resolver = self.analyze(call.syntax()).resolver; | 512 | let resolver = self.analyze(call.syntax()).resolver; |
512 | let ty = Type::new_with_resolver(self.db, &resolver, ty)?; | 513 | let ty = Type::new_with_resolver(self.db, &resolver, ty)?; |
513 | let mut res = ty.as_callable(self.db)?; | 514 | let mut res = ty.as_callable(self.db)?; |