Fix tuple test case

This commit is contained in:
Hirokazu Hata 2019-01-13 22:01:33 +09:00
parent 6e73cc89b6
commit 139da0841d
2 changed files with 35 additions and 6 deletions

View file

@ -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",

View file

@ -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]