From 478ce1c8b5288432509f39aeb5b611e7614d0e03 Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Mon, 14 Jan 2019 22:52:05 +0900 Subject: Fix infer array test --- crates/ra_hir/src/ty/tests.rs | 15 +++--- crates/ra_hir/src/ty/tests/data/array.txt | 82 ++++++++++++++++++------------- 2 files changed, 57 insertions(+), 40 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 09c8644f7..dd574162a 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -343,14 +343,17 @@ fn test(x: &str, y: isize) { let b = [a, a]; let c = [b, b]; - let d = [y]; - let e = [d, d]; - let f = [e, e]; + let d = [y, 1, 2, 3] + let d = [1, y, 2, 3] + let e = [y]; + let f = [d, d]; + let g = [e, e]; + + let h = [1, 2]; + let i = ["a", "b"]; - // we have not infered these case yet. - let g = [1, 2]; - let h = ["a", "b"]; let b = [a, ["b"]]; + let x: [u8; 0] = []; } "#, "array.txt", diff --git a/crates/ra_hir/src/ty/tests/data/array.txt b/crates/ra_hir/src/ty/tests/data/array.txt index 7711e378b..66f09485d 100644 --- a/crates/ra_hir/src/ty/tests/data/array.txt +++ b/crates/ra_hir/src/ty/tests/data/array.txt @@ -1,38 +1,52 @@ [9; 10) 'x': &str [18; 19) 'y': isize -[28; 258) '{ ..."]]; }': () -[38; 39) 'a': [&str,] -[42; 45) '[x]': [&str,] +[28; 291) '{ ... []; }': () +[38; 39) 'a': [&str] +[42; 45) '[x]': [&str] [43; 44) 'x': &str -[55; 56) 'b': [[&str,], [&str,]] -[59; 65) '[a, a]': [[&str,], [&str,]] -[60; 61) 'a': [&str,] -[63; 64) 'a': [&str,] -[75; 76) 'c': [[[&str,], [&str,]], [[&str,], [&str,]]] -[79; 85) '[b, b]': [[[&str,], [&str,]], [[&str,], [&str,]]] -[80; 81) 'b': [[&str,], [&str,]] -[83; 84) 'b': [[&str,], [&str,]] -[96; 97) 'd': [isize,] -[100; 103) '[y]': [isize,] +[55; 56) 'b': [[&str]] +[59; 65) '[a, a]': [[&str]] +[60; 61) 'a': [&str] +[63; 64) 'a': [&str] +[75; 76) 'c': [[[&str]]] +[79; 85) '[b, b]': [[[&str]]] +[80; 81) 'b': [[&str]] +[83; 84) 'b': [[&str]] +[96; 97) 'd': [isize] +[100; 112) '[y, 1, 2, 3]': [isize] [101; 102) 'y': isize -[113; 114) 'e': [[isize,], [isize,]] -[117; 123) '[d, d]': [[isize,], [isize,]] -[118; 119) 'd': [isize,] -[121; 122) 'd': [isize,] -[133; 134) 'f': [[[isize,], [isize,]], [[isize,], [isize,]]] -[137; 143) '[e, e]': [[[isize,], [isize,]], [[isize,], [isize,]]] -[138; 139) 'e': [[isize,], [isize,]] -[141; 142) 'e': [[isize,], [isize,]] -[197; 198) 'g': [_, _] -[201; 207) '[1, 2]': [_, _] -[202; 203) '1': [unknown] -[205; 206) '2': [unknown] -[217; 218) 'h': [_, _] -[221; 231) '["a", "b"]': [_, _] -[222; 225) '"a"': [unknown] -[227; 230) '"b"': [unknown] -[241; 242) 'b': [[&str,], [_,]] -[245; 255) '[a, ["b"]]': [[&str,], [_,]] -[246; 247) 'a': [&str,] -[249; 254) '["b"]': [_,] -[250; 253) '"b"': [unknown] +[104; 105) '1': isize +[107; 108) '2': isize +[110; 111) '3': isize +[121; 122) 'd': [isize] +[125; 137) '[1, y, 2, 3]': [isize] +[126; 127) '1': isize +[129; 130) 'y': isize +[132; 133) '2': isize +[135; 136) '3': isize +[146; 147) 'e': [isize] +[150; 153) '[y]': [isize] +[151; 152) 'y': isize +[163; 164) 'f': [[isize]] +[167; 173) '[d, d]': [[isize]] +[168; 169) 'd': [isize] +[171; 172) 'd': [isize] +[183; 184) 'g': [[isize]] +[187; 193) '[e, e]': [[isize]] +[188; 189) 'e': [isize] +[191; 192) 'e': [isize] +[204; 205) 'h': [_] +[208; 214) '[1, 2]': [_] +[209; 210) '1': [unknown] +[212; 213) '2': [unknown] +[224; 225) 'i': [_] +[228; 238) '["a", "b"]': [_] +[229; 232) '"a"': [unknown] +[234; 237) '"b"': [unknown] +[249; 250) 'b': [[&str]] +[253; 263) '[a, ["b"]]': [[&str]] +[254; 255) 'a': [&str] +[257; 262) '["b"]': [&str] +[258; 261) '"b"': &str +[273; 274) 'x': [u8] +[286; 288) '[]': [u8] -- cgit v1.2.3