aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 815aecda7..1c3129441 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -242,6 +242,32 @@ fn test() {
242 ); 242 );
243} 243}
244 244
245#[test]
246fn infer_inherent_method() {
247 check_inference(
248 r#"
249struct A;
250
251impl A {
252 fn foo(self, x: u32) -> i32 {}
253}
254
255mod b {
256 impl super::A {
257 fn bar(&self, x: u64) -> i64 {}
258 }
259}
260
261fn test(a: A) {
262 a.foo(1);
263 (&a).bar(1);
264 a.bar(1);
265}
266"#,
267 "inherent_method.txt",
268 );
269}
270
245fn infer(content: &str) -> String { 271fn infer(content: &str) -> String {
246 let (db, _, file_id) = MockDatabase::with_single_file(content); 272 let (db, _, file_id) = MockDatabase::with_single_file(content);
247 let source_file = db.source_file(file_id); 273 let source_file = db.source_file(file_id);