add_explicit_type respects coercions

This commit is contained in:
Lukas Wirth 2021-07-10 18:19:46 +02:00
parent d5a43d1f85
commit 576e3a4e12
4 changed files with 43 additions and 2 deletions

View file

@ -216,6 +216,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
self.imp.type_of_expr(expr)
}
pub fn type_of_expr_with_coercion(&self, expr: &ast::Expr) -> Option<Type> {
self.imp.type_of_expr_with_coercion(expr)
}
pub fn type_of_pat(&self, pat: &ast::Pat) -> Option<Type> {
self.imp.type_of_pat(pat)
}
@ -560,6 +564,10 @@ impl<'db> SemanticsImpl<'db> {
self.analyze(expr.syntax()).type_of_expr(self.db, expr)
}
fn type_of_expr_with_coercion(&self, expr: &ast::Expr) -> Option<Type> {
self.analyze(expr.syntax()).type_of_expr_with_coercion(self.db, expr)
}
fn type_of_pat(&self, pat: &ast::Pat) -> Option<Type> {
self.analyze(pat.syntax()).type_of_pat(self.db, pat)
}