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 None
} }
pub fn type_parameters(&self) -> impl Iterator<Item = Type> + '_ { pub fn type_arguments(&self) -> impl Iterator<Item = Type> + '_ {
self.ty self.ty
.strip_references() .strip_references()
.as_adt() .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 name = adt.name(sema.db);
let idx = path.rfind(':').map_or(0, |idx| idx + 1); let idx = path.rfind(':').map_or(0, |idx| idx + 1);
let (prefix, suffix) = path.split_at(idx); let (prefix, suffix) = path.split_at(idx);
let mut ty_params = ty.type_parameters().peekable(); let mut ty_args = ty.type_arguments().peekable();
let params = if ty_params.peek().is_some() { let params = if ty_args.peek().is_some() {
format!( format!(
"<{}>", "<{}>",
ty_params.format_with(", ", |ty, cb| cb(&ty.display(sema.db))) ty_args.format_with(", ", |ty, cb| cb(&ty.display(sema.db)))
) )
} else { } else {
String::new() 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 } } => { FlowHandler::Try { kind: TryKind::Result { ty: parent_ret_ty } } => {
let handler_ty = parent_ret_ty let handler_ty = parent_ret_ty
.type_parameters() .type_arguments()
.nth(1) .nth(1)
.map(|ty| make_ty(&ty, ctx, module)) .map(|ty| make_ty(&ty, ctx, module))
.unwrap_or_else(make::ty_unit); .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(); let name = adt.name(db).to_string();
if WRAPPER_TYPES.contains(&name.as_str()) { 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); return name_of_type(&inner_ty, db);
} }