mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Expose coercions for patterns and expressions in semantics
This commit is contained in:
parent
576e3a4e12
commit
7e6f40b6f1
3 changed files with 31 additions and 7 deletions
|
@ -216,7 +216,7 @@ 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> {
|
||||
pub fn type_of_expr_with_coercion(&self, expr: &ast::Expr) -> Option<(Type, Option<Type>)> {
|
||||
self.imp.type_of_expr_with_coercion(expr)
|
||||
}
|
||||
|
||||
|
@ -224,6 +224,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
|
|||
self.imp.type_of_pat(pat)
|
||||
}
|
||||
|
||||
pub fn type_of_pat_with_coercion(&self, expr: &ast::Pat) -> Option<(Type, Option<Type>)> {
|
||||
self.imp.type_of_pat_with_coercion(expr)
|
||||
}
|
||||
|
||||
pub fn type_of_self(&self, param: &ast::SelfParam) -> Option<Type> {
|
||||
self.imp.type_of_self(param)
|
||||
}
|
||||
|
@ -564,7 +568,7 @@ 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> {
|
||||
fn type_of_expr_with_coercion(&self, expr: &ast::Expr) -> Option<(Type, Option<Type>)> {
|
||||
self.analyze(expr.syntax()).type_of_expr_with_coercion(self.db, expr)
|
||||
}
|
||||
|
||||
|
@ -572,6 +576,10 @@ impl<'db> SemanticsImpl<'db> {
|
|||
self.analyze(pat.syntax()).type_of_pat(self.db, pat)
|
||||
}
|
||||
|
||||
fn type_of_pat_with_coercion(&self, pat: &ast::Pat)-> Option<(Type, Option<Type>)> {
|
||||
self.analyze(pat.syntax()).type_of_pat_with_coercion(self.db, pat)
|
||||
}
|
||||
|
||||
fn type_of_self(&self, param: &ast::SelfParam) -> Option<Type> {
|
||||
self.analyze(param.syntax()).type_of_self(self.db, param)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue