diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-04 20:28:09 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-04 20:28:09 +0000 |
commit | 77a824c6a0db6ac2548841d290d5d61d1d23295c (patch) | |
tree | f454c7a7ae451f467a2d4cff2464e502380c730b /crates/ra_hir/src/ty | |
parent | cc3423c662b671680042ae6d83f01113f1bbb089 (diff) | |
parent | 5227102c129fd6efe73a143e3dab25a6d267f3df (diff) |
Merge #741
741: Test more Self inference r=flodiebold a=kjeremy
These cases didn't look covered.
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/snapshots/tests__infer_self.snap | 10 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_self.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_self.snap index 84c8b1e90..5c927f5c1 100644 --- a/crates/ra_hir/src/ty/snapshots/tests__infer_self.snap +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_self.snap | |||
@@ -1,8 +1,8 @@ | |||
1 | --- | 1 | --- |
2 | created: "2019-01-22T14:45:00.052694700+00:00" | 2 | created: "2019-02-04T19:40:48.826936500+00:00" |
3 | creator: insta@0.4.0 | 3 | creator: insta@0.5.3 |
4 | expression: "&result" | 4 | expression: "&result" |
5 | source: "crates\\ra_hir\\src\\ty\\tests.rs" | 5 | source: crates/ra_hir/src/ty/tests.rs |
6 | --- | 6 | --- |
7 | [34; 38) 'self': &S | 7 | [34; 38) 'self': &S |
8 | [40; 61) '{ ... }': () | 8 | [40; 61) '{ ... }': () |
@@ -10,4 +10,8 @@ source: "crates\\ra_hir\\src\\ty\\tests.rs" | |||
10 | [75; 79) 'self': &S | 10 | [75; 79) 'self': &S |
11 | [88; 109) '{ ... }': () | 11 | [88; 109) '{ ... }': () |
12 | [98; 102) 'self': &S | 12 | [98; 102) 'self': &S |
13 | [133; 153) '{ ... }': S | ||
14 | [143; 147) 'S {}': S | ||
15 | [177; 200) '{ ... }': S | ||
16 | [187; 194) 'Self {}': S | ||
13 | 17 | ||
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index cb8d6351d..30da8fc23 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -215,6 +215,12 @@ impl S { | |||
215 | fn test2(self: &Self) { | 215 | fn test2(self: &Self) { |
216 | self; | 216 | self; |
217 | } | 217 | } |
218 | fn test3() -> Self { | ||
219 | S {} | ||
220 | } | ||
221 | fn test4() -> Self { | ||
222 | Self {} | ||
223 | } | ||
218 | } | 224 | } |
219 | "#, | 225 | "#, |
220 | ); | 226 | ); |