From 139da0841d720fc75a3c449c37f9e198cd7dcda9 Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Sun, 13 Jan 2019 22:01:33 +0900 Subject: [PATCH] Fix tuple test case --- crates/ra_hir/src/ty/tests.rs | 9 ++++++- 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 4031cd7352b..920188fc912 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) { fn infer_tuple() { check_inference( r#" -fn test() { +fn test(x: &str, y: isize) { let a: (u32, &str) = (1, "a"); + let b = (a, x); + let c = (y, x); + let d = (c, x); + + // we have not infered these case yet. + let e = (1, "e"); + let f = (e, "d"); } "#, "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 daf0bf56025..96169180d49 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 @@ -[11; 49) '{ ...a"); }': () -[21; 22) 'a': (u32, &str) -[38; 46) '(1, "a")': (u32, &str) -[39; 40) '1': u32 -[42; 45) '"a"': &str +[9; 10) 'x': &str +[18; 19) 'y': isize +[28; 214) '{ ...d"); }': () +[38; 39) 'a': (u32, &str) +[55; 63) '(1, "a")': (u32, &str) +[56; 57) '1': u32 +[59; 62) '"a"': &str +[73; 74) 'b': ((u32, &str), &str) +[77; 83) '(a, x)': ((u32, &str), &str) +[78; 79) 'a': (u32, &str) +[81; 82) 'x': &str +[93; 94) 'c': (isize, &str) +[97; 103) '(y, x)': (isize, &str) +[98; 99) 'y': isize +[101; 102) 'x': &str +[113; 114) 'd': ((isize, &str), &str) +[117; 123) '(c, x)': ((isize, &str), &str) +[118; 119) 'c': (isize, &str) +[121; 122) 'x': &str +[177; 178) 'e': ([unknown], [unknown]) +[181; 189) '(1, "e")': ([unknown], [unknown]) +[182; 183) '1': [unknown] +[185; 188) '"e"': [unknown] +[199; 200) 'f': (([unknown], [unknown]), [unknown]) +[203; 211) '(e, "d")': (([unknown], [unknown]), [unknown]) +[204; 205) 'e': ([unknown], [unknown]) +[207; 210) '"d"': [unknown]