internal: fix naming polarity

Type Constructors have *parameters*, when they are substituted with type
*arguments*, we have a type.
This commit is contained in:
Aleksey Kladov 2021-04-30 11:55:59 +03:00
parent cb3ef552e8
commit 1a01a5ae19
4 changed files with 6 additions and 6 deletions

View File

@ -1984,7 +1984,7 @@ impl Type {
None
}
pub fn type_parameters(&self) -> impl Iterator<Item = Type> + '_ {
pub fn type_arguments(&self) -> impl Iterator<Item = Type> + '_ {
self.ty
.strip_references()
.as_adt()

View File

@ -304,11 +304,11 @@ fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Op
let name = adt.name(sema.db);
let idx = path.rfind(':').map_or(0, |idx| idx + 1);
let (prefix, suffix) = path.split_at(idx);
let mut ty_params = ty.type_parameters().peekable();
let params = if ty_params.peek().is_some() {
let mut ty_args = ty.type_arguments().peekable();
let params = if ty_args.peek().is_some() {
format!(
"<{}>",
ty_params.format_with(", ", |ty, cb| cb(&ty.display(sema.db)))
ty_args.format_with(", ", |ty, cb| cb(&ty.display(sema.db)))
)
} else {
String::new()

View File

@ -1183,7 +1183,7 @@ fn make_ret_ty(ctx: &AssistContext, module: hir::Module, fun: &Function) -> Opti
}
FlowHandler::Try { kind: TryKind::Result { ty: parent_ret_ty } } => {
let handler_ty = parent_ret_ty
.type_parameters()
.type_arguments()
.nth(1)
.map(|ty| make_ty(&ty, ctx, module))
.unwrap_or_else(make::ty_unit);

View File

@ -227,7 +227,7 @@ fn name_of_type(ty: &hir::Type, db: &RootDatabase) -> Option<String> {
let name = adt.name(db).to_string();
if WRAPPER_TYPES.contains(&name.as_str()) {
let inner_ty = ty.type_parameters().next()?;
let inner_ty = ty.type_arguments().next()?;
return name_of_type(&inner_ty, db);
}