Skip to content

Commit c14a4e7

Browse files
committed
Fix infer array test
1 parent e2eb53d commit c14a4e7

File tree

2 files changed

+57
-40
lines changed

2 files changed

+57
-40
lines changed

crates/ra_hir/src/ty/tests.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,17 @@ fn test(x: &str, y: isize) {
296296
let b = [a, a];
297297
let c = [b, b];
298298
299-
let d = [y];
300-
let e = [d, d];
301-
let f = [e, e];
299+
let d = [y, 1, 2, 3]
300+
let d = [1, y, 2, 3]
301+
let e = [y];
302+
let f = [d, d];
303+
let g = [e, e];
304+
305+
let h = [1, 2];
306+
let i = ["a", "b"];
302307
303-
// we have not infered these case yet.
304-
let g = [1, 2];
305-
let h = ["a", "b"];
306308
let b = [a, ["b"]];
309+
let x: [u8; 0] = [];
307310
}
308311
"#,
309312
"array.txt",
Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,52 @@
11
[9; 10) 'x': &str
22
[18; 19) 'y': isize
3-
[28; 258) '{ ..."]]; }': ()
4-
[38; 39) 'a': [&str,]
5-
[42; 45) '[x]': [&str,]
3+
[28; 291) '{ ... []; }': ()
4+
[38; 39) 'a': [&str]
5+
[42; 45) '[x]': [&str]
66
[43; 44) 'x': &str
7-
[55; 56) 'b': [[&str,], [&str,]]
8-
[59; 65) '[a, a]': [[&str,], [&str,]]
9-
[60; 61) 'a': [&str,]
10-
[63; 64) 'a': [&str,]
11-
[75; 76) 'c': [[[&str,], [&str,]], [[&str,], [&str,]]]
12-
[79; 85) '[b, b]': [[[&str,], [&str,]], [[&str,], [&str,]]]
13-
[80; 81) 'b': [[&str,], [&str,]]
14-
[83; 84) 'b': [[&str,], [&str,]]
15-
[96; 97) 'd': [isize,]
16-
[100; 103) '[y]': [isize,]
7+
[55; 56) 'b': [[&str]]
8+
[59; 65) '[a, a]': [[&str]]
9+
[60; 61) 'a': [&str]
10+
[63; 64) 'a': [&str]
11+
[75; 76) 'c': [[[&str]]]
12+
[79; 85) '[b, b]': [[[&str]]]
13+
[80; 81) 'b': [[&str]]
14+
[83; 84) 'b': [[&str]]
15+
[96; 97) 'd': [isize]
16+
[100; 112) '[y, 1, 2, 3]': [isize]
1717
[101; 102) 'y': isize
18-
[113; 114) 'e': [[isize,], [isize,]]
19-
[117; 123) '[d, d]': [[isize,], [isize,]]
20-
[118; 119) 'd': [isize,]
21-
[121; 122) 'd': [isize,]
22-
[133; 134) 'f': [[[isize,], [isize,]], [[isize,], [isize,]]]
23-
[137; 143) '[e, e]': [[[isize,], [isize,]], [[isize,], [isize,]]]
24-
[138; 139) 'e': [[isize,], [isize,]]
25-
[141; 142) 'e': [[isize,], [isize,]]
26-
[197; 198) 'g': [_, _]
27-
[201; 207) '[1, 2]': [_, _]
28-
[202; 203) '1': [unknown]
29-
[205; 206) '2': [unknown]
30-
[217; 218) 'h': [_, _]
31-
[221; 231) '["a", "b"]': [_, _]
32-
[222; 225) '"a"': [unknown]
33-
[227; 230) '"b"': [unknown]
34-
[241; 242) 'b': [[&str,], [_,]]
35-
[245; 255) '[a, ["b"]]': [[&str,], [_,]]
36-
[246; 247) 'a': [&str,]
37-
[249; 254) '["b"]': [_,]
38-
[250; 253) '"b"': [unknown]
18+
[104; 105) '1': isize
19+
[107; 108) '2': isize
20+
[110; 111) '3': isize
21+
[121; 122) 'd': [isize]
22+
[125; 137) '[1, y, 2, 3]': [isize]
23+
[126; 127) '1': isize
24+
[129; 130) 'y': isize
25+
[132; 133) '2': isize
26+
[135; 136) '3': isize
27+
[146; 147) 'e': [isize]
28+
[150; 153) '[y]': [isize]
29+
[151; 152) 'y': isize
30+
[163; 164) 'f': [[isize]]
31+
[167; 173) '[d, d]': [[isize]]
32+
[168; 169) 'd': [isize]
33+
[171; 172) 'd': [isize]
34+
[183; 184) 'g': [[isize]]
35+
[187; 193) '[e, e]': [[isize]]
36+
[188; 189) 'e': [isize]
37+
[191; 192) 'e': [isize]
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]

0 commit comments

Comments
 (0)