aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorHirokazu Hata <[email protected]>2019-01-14 13:52:05 +0000
committerHirokazu Hata <[email protected]>2019-01-16 14:37:42 +0000
commit478ce1c8b5288432509f39aeb5b611e7614d0e03 (patch)
treeb93a2ee1b6f3ea7152bbbd6f5d4d96ba66b4b040 /crates
parent5d3884d5b49e06991f8f1b0d9031f8dd37edd6ab (diff)
Fix infer array test
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/ty/tests.rs15
-rw-r--r--crates/ra_hir/src/ty/tests/data/array.txt82
2 files changed, 57 insertions, 40 deletions
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) {
343 let b = [a, a]; 343 let b = [a, a];
344 let c = [b, b]; 344 let c = [b, b];
345 345
346 let d = [y]; 346 let d = [y, 1, 2, 3]
347 let e = [d, d]; 347 let d = [1, y, 2, 3]
348 let f = [e, e]; 348 let e = [y];
349 let f = [d, d];
350 let g = [e, e];
351
352 let h = [1, 2];
353 let i = ["a", "b"];
349 354
350 // we have not infered these case yet.
351 let g = [1, 2];
352 let h = ["a", "b"];
353 let b = [a, ["b"]]; 355 let b = [a, ["b"]];
356 let x: [u8; 0] = [];
354} 357}
355"#, 358"#,
356 "array.txt", 359 "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 @@
1[9; 10) 'x': &str 1[9; 10) 'x': &str
2[18; 19) 'y': isize 2[18; 19) 'y': isize
3[28; 258) '{ ..."]]; }': () 3[28; 291) '{ ... []; }': ()
4[38; 39) 'a': [&str,] 4[38; 39) 'a': [&str]
5[42; 45) '[x]': [&str,] 5[42; 45) '[x]': [&str]
6[43; 44) 'x': &str 6[43; 44) 'x': &str
7[55; 56) 'b': [[&str,], [&str,]] 7[55; 56) 'b': [[&str]]
8[59; 65) '[a, a]': [[&str,], [&str,]] 8[59; 65) '[a, a]': [[&str]]
9[60; 61) 'a': [&str,] 9[60; 61) 'a': [&str]
10[63; 64) 'a': [&str,] 10[63; 64) 'a': [&str]
11[75; 76) 'c': [[[&str,], [&str,]], [[&str,], [&str,]]] 11[75; 76) 'c': [[[&str]]]
12[79; 85) '[b, b]': [[[&str,], [&str,]], [[&str,], [&str,]]] 12[79; 85) '[b, b]': [[[&str]]]
13[80; 81) 'b': [[&str,], [&str,]] 13[80; 81) 'b': [[&str]]
14[83; 84) 'b': [[&str,], [&str,]] 14[83; 84) 'b': [[&str]]
15[96; 97) 'd': [isize,] 15[96; 97) 'd': [isize]
16[100; 103) '[y]': [isize,] 16[100; 112) '[y, 1, 2, 3]': [isize]
17[101; 102) 'y': isize 17[101; 102) 'y': isize
18[113; 114) 'e': [[isize,], [isize,]] 18[104; 105) '1': isize
19[117; 123) '[d, d]': [[isize,], [isize,]] 19[107; 108) '2': isize
20[118; 119) 'd': [isize,] 20[110; 111) '3': isize
21[121; 122) 'd': [isize,] 21[121; 122) 'd': [isize]
22[133; 134) 'f': [[[isize,], [isize,]], [[isize,], [isize,]]] 22[125; 137) '[1, y, 2, 3]': [isize]
23[137; 143) '[e, e]': [[[isize,], [isize,]], [[isize,], [isize,]]] 23[126; 127) '1': isize
24[138; 139) 'e': [[isize,], [isize,]] 24[129; 130) 'y': isize
25[141; 142) 'e': [[isize,], [isize,]] 25[132; 133) '2': isize
26[197; 198) 'g': [_, _] 26[135; 136) '3': isize
27[201; 207) '[1, 2]': [_, _] 27[146; 147) 'e': [isize]
28[202; 203) '1': [unknown] 28[150; 153) '[y]': [isize]
29[205; 206) '2': [unknown] 29[151; 152) 'y': isize
30[217; 218) 'h': [_, _] 30[163; 164) 'f': [[isize]]
31[221; 231) '["a", "b"]': [_, _] 31[167; 173) '[d, d]': [[isize]]
32[222; 225) '"a"': [unknown] 32[168; 169) 'd': [isize]
33[227; 230) '"b"': [unknown] 33[171; 172) 'd': [isize]
34[241; 242) 'b': [[&str,], [_,]] 34[183; 184) 'g': [[isize]]
35[245; 255) '[a, ["b"]]': [[&str,], [_,]] 35[187; 193) '[e, e]': [[isize]]
36[246; 247) 'a': [&str,] 36[188; 189) 'e': [isize]
37[249; 254) '["b"]': [_,] 37[191; 192) 'e': [isize]
38[250; 253) '"b"': [unknown] 38[204; 205) 'h': [_]
39[208; 214) '[1, 2]': [_]
40[209; 210) '1': [unknown]
41[212; 213) '2': [unknown]
42[224; 225) 'i': [_]
43[228; 238) '["a", "b"]': [_]
44[229; 232) '"a"': [unknown]
45[234; 237) '"b"': [unknown]
46[249; 250) 'b': [[&str]]
47[253; 263) '[a, ["b"]]': [[&str]]
48[254; 255) 'a': [&str]
49[257; 262) '["b"]': [&str]
50[258; 261) '"b"': &str
51[273; 274) 'x': [u8]
52[286; 288) '[]': [u8]