diff options
author | Aleksey Kladov <[email protected]> | 2020-08-19 14:16:24 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-08-19 14:16:24 +0100 |
commit | b9b4693ce3bf0229ea40f09e6404fad3e7823321 (patch) | |
tree | 5ef5dceeeafb7105f41b6fe12bb1563f424f2e87 /crates/ssr/src | |
parent | a3b0a3aeb8061fc65951dd540bc92b94a96b4f2b (diff) |
Add SelfParam to code_model
Diffstat (limited to 'crates/ssr/src')
-rw-r--r-- | crates/ssr/src/matching.rs | 2 | ||||
-rw-r--r-- | crates/ssr/src/resolving.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crates/ssr/src/matching.rs b/crates/ssr/src/matching.rs index 8bb5ced90..26968c474 100644 --- a/crates/ssr/src/matching.rs +++ b/crates/ssr/src/matching.rs | |||
@@ -545,7 +545,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
545 | // If the function we're calling takes a self parameter, then we store additional | 545 | // If the function we're calling takes a self parameter, then we store additional |
546 | // information on the placeholder match about autoderef and autoref. This allows us to use | 546 | // information on the placeholder match about autoderef and autoref. This allows us to use |
547 | // the placeholder in a context where autoderef and autoref don't apply. | 547 | // the placeholder in a context where autoderef and autoref don't apply. |
548 | if code_resolved_function.has_self_param(self.sema.db) { | 548 | if code_resolved_function.self_param(self.sema.db).is_some() { |
549 | if let (Some(pattern_type), Some(expr)) = (&pattern_ufcs.qualifier_type, &code.expr()) { | 549 | if let (Some(pattern_type), Some(expr)) = (&pattern_ufcs.qualifier_type, &code.expr()) { |
550 | let deref_count = self.check_expr_type(pattern_type, expr)?; | 550 | let deref_count = self.check_expr_type(pattern_type, expr)?; |
551 | let pattern_receiver = pattern_args.next(); | 551 | let pattern_receiver = pattern_args.next(); |
diff --git a/crates/ssr/src/resolving.rs b/crates/ssr/src/resolving.rs index b932132d5..5d2cbec47 100644 --- a/crates/ssr/src/resolving.rs +++ b/crates/ssr/src/resolving.rs | |||
@@ -165,7 +165,7 @@ impl Resolver<'_, '_> { | |||
165 | fn ok_to_use_path_resolution(&self, resolution: &hir::PathResolution) -> bool { | 165 | fn ok_to_use_path_resolution(&self, resolution: &hir::PathResolution) -> bool { |
166 | match resolution { | 166 | match resolution { |
167 | hir::PathResolution::AssocItem(hir::AssocItem::Function(function)) => { | 167 | hir::PathResolution::AssocItem(hir::AssocItem::Function(function)) => { |
168 | if function.has_self_param(self.resolution_scope.scope.db) { | 168 | if function.self_param(self.resolution_scope.scope.db).is_some() { |
169 | // If we don't use this path resolution, then we won't be able to match method | 169 | // If we don't use this path resolution, then we won't be able to match method |
170 | // calls. e.g. `Foo::bar($s)` should match `x.bar()`. | 170 | // calls. e.g. `Foo::bar($s)` should match `x.bar()`. |
171 | true | 171 | true |