the "add missing members" assists: implemented substitution of default values of const params

This commit is contained in:
ponyii 2023-06-30 17:31:04 +04:00
parent 6918eb6ebd
commit 52b4392724
8 changed files with 127 additions and 52 deletions

View file

@ -158,8 +158,14 @@ impl<'a> PathTransform<'a> {
const_substs.insert(k, expr.syntax().clone());
}
}
(Either::Left(_), None) => (), // FIXME: get default const value
_ => (), // ignore mismatching params
(Either::Left(k), None) => {
if let Some(default) = k.default(db) {
let default = ast::make::expr_const_value(&default);
const_substs.insert(k, default.syntax().clone_for_update());
// FIXME: transform the default value
}
}
_ => (), // ignore mismatching params
});
let lifetime_substs: FxHashMap<_, _> = self
.generic_def