From 226e31dae94f2c72f5cf650564e521b792793629 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Wed, 26 Dec 2018 21:28:05 +0100 Subject: Add test for self type inference --- crates/ra_hir/src/ty/tests.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crates/ra_hir/src/ty/tests.rs') diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 93bf431c4..fb53fcf0b 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -134,6 +134,25 @@ fn test() -> &mut &f64 { ); } +#[test] +fn infer_self() { + check_inference( + r#" +struct S; + +impl S { + fn test(&self) { + self; + } + fn test2(self: &Self) { + self; + } +} +"#, + "0007_self.txt", + ); +} + fn infer(content: &str) -> String { let (db, _, file_id) = MockDatabase::with_single_file(content); let source_file = db.source_file(file_id); -- cgit v1.2.3