Give TypeInfo fields and methods more appropriate names

This commit is contained in:
Lukas Wirth 2021-08-03 17:28:51 +02:00
parent 8afa2722b2
commit b96f1adf5c
30 changed files with 76 additions and 74 deletions

View file

@ -345,7 +345,7 @@ impl FlowKind {
FlowKind::Return(Some(expr))
| FlowKind::Break(Some(expr))
| FlowKind::TryReturn { expr, .. } => {
ctx.sema.type_of_expr(expr).map(TypeInfo::coerced)
ctx.sema.type_of_expr(expr).map(TypeInfo::adjusted)
}
FlowKind::Try { .. } => {
stdx::never!("try does not have defined expr_ty");
@ -852,7 +852,7 @@ fn either_syntax(value: &Either<ast::IdentPat, ast::SelfParam>) -> &SyntaxNode {
fn body_return_ty(ctx: &AssistContext, body: &FunctionBody) -> Option<RetType> {
match body.tail_expr() {
Some(expr) => ctx.sema.type_of_expr(&expr).map(TypeInfo::ty).map(RetType::Expr),
Some(expr) => ctx.sema.type_of_expr(&expr).map(TypeInfo::original).map(RetType::Expr),
None => Some(RetType::Stmt),
}
}
@ -949,7 +949,7 @@ fn expr_err_kind(expr: &ast::Expr, ctx: &AssistContext) -> Option<TryKind> {
let text = func_name.syntax().text();
if text == "Err" {
Some(TryKind::Result { ty: ctx.sema.type_of_expr(expr).map(TypeInfo::ty)? })
Some(TryKind::Result { ty: ctx.sema.type_of_expr(expr).map(TypeInfo::original)? })
} else if text == "None" {
Some(TryKind::Option)
} else {