Introduce TypeInfo

This commit is contained in:
Lukas Wirth 2021-08-02 20:42:25 +02:00
parent 29506b5a26
commit 25ff7171c4
32 changed files with 127 additions and 124 deletions

View file

@ -609,9 +609,13 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
expr: &ast::Expr,
) -> Result<usize, MatchFailed> {
use hir::HirDisplay;
let code_type = self.sema.type_of_expr(expr).ok_or_else(|| {
match_error!("Failed to get receiver type for `{}`", expr.syntax().text())
})?;
let code_type = self
.sema
.type_of_expr(expr)
.ok_or_else(|| {
match_error!("Failed to get receiver type for `{}`", expr.syntax().text())
})?
.ty;
// Temporary needed to make the borrow checker happy.
let res = code_type
.autoderef(self.sema.db)