Add SelfParam to code_model

This commit is contained in:
Aleksey Kladov 2020-08-19 15:16:24 +02:00
parent a3b0a3aeb8
commit b9b4693ce3
9 changed files with 62 additions and 43 deletions

View file

@ -165,7 +165,7 @@ impl Resolver<'_, '_> {
fn ok_to_use_path_resolution(&self, resolution: &hir::PathResolution) -> bool {
match resolution {
hir::PathResolution::AssocItem(hir::AssocItem::Function(function)) => {
if function.has_self_param(self.resolution_scope.scope.db) {
if function.self_param(self.resolution_scope.scope.db).is_some() {
// If we don't use this path resolution, then we won't be able to match method
// calls. e.g. `Foo::bar($s)` should match `x.bar()`.
true