aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2018-12-25 16:17:39 +0000
committerFlorian Diebold <[email protected]>2018-12-25 19:36:06 +0000
commit2870effd5c69941bbf32a44c0ee6d9d42e0b038d (patch)
treebf2c5ff08e6f316c1d9d629ae3595e6f7c069e5d /crates/ra_hir/src/ty/tests.rs
parentb96d3612390e070936a176571c946ad0cafa69a9 (diff)
Implement reference / pointer types
- parse them - infer types of & and * expressions
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 9bb58ec85..a76925b58 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -91,6 +91,28 @@ fn test() {
91 ); 91 );
92} 92}
93 93
94#[test]
95fn infer_refs_and_ptrs() {
96 check_inference(
97 r#"
98fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) {
99 a;
100 *a;
101 &a;
102 &mut a;
103 b;
104 *b;
105 &b;
106 c;
107 *c;
108 d;
109 *d;
110}
111"#,
112 "0005_refs.txt",
113 );
114}
115
94fn infer(content: &str) -> String { 116fn infer(content: &str) -> String {
95 let (db, _, file_id) = MockDatabase::with_single_file(content); 117 let (db, _, file_id) = MockDatabase::with_single_file(content);
96 let source_file = db.source_file(file_id); 118 let source_file = db.source_file(file_id);