diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-14 20:58:20 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-14 20:58:20 +0000 |
commit | e8e82ce032f8678929b015e6f70ac060bb2cf94c (patch) | |
tree | 9fb158e9f7115bb70cf2b8623b70710c55497ed4 /crates/ra_hir/src/ty/tests/data/struct.txt | |
parent | 784ff638e549a27503b719e5c2f0009b40d25364 (diff) | |
parent | 37ba237e6686d94783d1f025d23823ad7c0cb0c8 (diff) |
Merge #485
485: Add type inference for a bunch of primitives r=flodiebold a=marcusklaas
This PR adds inference for `&str`, `&[u8]`, `char`, `bool`, floats and integers. For floats and integers it uses type variables to infer the exact type, i.e. `u32`, from context when it's not annotated explicitly.
I'm not quite happy with the implementation yet, but I think it mostly works now.
Co-authored-by: Marcus Klaas de Vries <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/tests/data/struct.txt')
-rw-r--r-- | crates/ra_hir/src/ty/tests/data/struct.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/tests/data/struct.txt b/crates/ra_hir/src/ty/tests/data/struct.txt index 7b324c82f..be9e12d02 100644 --- a/crates/ra_hir/src/ty/tests/data/struct.txt +++ b/crates/ra_hir/src/ty/tests/data/struct.txt | |||
@@ -2,14 +2,14 @@ | |||
2 | [82; 83) 'c': [unknown] | 2 | [82; 83) 'c': [unknown] |
3 | [86; 87) 'C': [unknown] | 3 | [86; 87) 'C': [unknown] |
4 | [86; 90) 'C(1)': [unknown] | 4 | [86; 90) 'C(1)': [unknown] |
5 | [88; 89) '1': [unknown] | 5 | [88; 89) '1': i32 |
6 | [96; 97) 'B': [unknown] | 6 | [96; 97) 'B': [unknown] |
7 | [107; 108) 'a': A | 7 | [107; 108) 'a': A |
8 | [114; 133) 'A { b:...C(1) }': A | 8 | [114; 133) 'A { b:...C(1) }': A |
9 | [121; 122) 'B': B | 9 | [121; 122) 'B': B |
10 | [127; 128) 'C': [unknown] | 10 | [127; 128) 'C': [unknown] |
11 | [127; 131) 'C(1)': C | 11 | [127; 131) 'C(1)': C |
12 | [129; 130) '1': [unknown] | 12 | [129; 130) '1': i32 |
13 | [139; 140) 'a': A | 13 | [139; 140) 'a': A |
14 | [139; 142) 'a.b': B | 14 | [139; 142) 'a.b': B |
15 | [148; 149) 'a': A | 15 | [148; 149) 'a': A |