diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 9 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests/data/tuple.txt | 32 |
2 files changed, 35 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 4031cd735..920188fc9 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -272,8 +272,15 @@ fn test(a: A) { | |||
272 | fn infer_tuple() { | 272 | fn infer_tuple() { |
273 | check_inference( | 273 | check_inference( |
274 | r#" | 274 | r#" |
275 | fn test() { | 275 | fn test(x: &str, y: isize) { |
276 | let a: (u32, &str) = (1, "a"); | 276 | let a: (u32, &str) = (1, "a"); |
277 | let b = (a, x); | ||
278 | let c = (y, x); | ||
279 | let d = (c, x); | ||
280 | |||
281 | // we have not infered these case yet. | ||
282 | let e = (1, "e"); | ||
283 | let f = (e, "d"); | ||
277 | } | 284 | } |
278 | "#, | 285 | "#, |
279 | "tuple.txt", | 286 | "tuple.txt", |
diff --git a/crates/ra_hir/src/ty/tests/data/tuple.txt b/crates/ra_hir/src/ty/tests/data/tuple.txt index daf0bf560..96169180d 100644 --- a/crates/ra_hir/src/ty/tests/data/tuple.txt +++ b/crates/ra_hir/src/ty/tests/data/tuple.txt | |||
@@ -1,5 +1,27 @@ | |||
1 | [11; 49) '{ ...a"); }': () | 1 | [9; 10) 'x': &str |
2 | [21; 22) 'a': (u32, &str) | 2 | [18; 19) 'y': isize |
3 | [38; 46) '(1, "a")': (u32, &str) | 3 | [28; 214) '{ ...d"); }': () |
4 | [39; 40) '1': u32 | 4 | [38; 39) 'a': (u32, &str) |
5 | [42; 45) '"a"': &str | 5 | [55; 63) '(1, "a")': (u32, &str) |
6 | [56; 57) '1': u32 | ||
7 | [59; 62) '"a"': &str | ||
8 | [73; 74) 'b': ((u32, &str), &str) | ||
9 | [77; 83) '(a, x)': ((u32, &str), &str) | ||
10 | [78; 79) 'a': (u32, &str) | ||
11 | [81; 82) 'x': &str | ||
12 | [93; 94) 'c': (isize, &str) | ||
13 | [97; 103) '(y, x)': (isize, &str) | ||
14 | [98; 99) 'y': isize | ||
15 | [101; 102) 'x': &str | ||
16 | [113; 114) 'd': ((isize, &str), &str) | ||
17 | [117; 123) '(c, x)': ((isize, &str), &str) | ||
18 | [118; 119) 'c': (isize, &str) | ||
19 | [121; 122) 'x': &str | ||
20 | [177; 178) 'e': ([unknown], [unknown]) | ||
21 | [181; 189) '(1, "e")': ([unknown], [unknown]) | ||
22 | [182; 183) '1': [unknown] | ||
23 | [185; 188) '"e"': [unknown] | ||
24 | [199; 200) 'f': (([unknown], [unknown]), [unknown]) | ||
25 | [203; 211) '(e, "d")': (([unknown], [unknown]), [unknown]) | ||
26 | [204; 205) 'e': ([unknown], [unknown]) | ||
27 | [207; 210) '"d"': [unknown] | ||