aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests/simple.rs
diff options
context:
space:
mode:
authorJade <[email protected]>2021-05-14 08:59:30 +0100
committerJade <[email protected]>2021-05-14 09:39:28 +0100
commit78d6b88f211cc9faf88815ce7fb1a91546cfce15 (patch)
tree6b54a10d2eeee6fc03d63015e4b7c9838b4b02b9 /crates/hir_ty/src/tests/simple.rs
parent32c600664e5a599bbe3f0254274211474b89914a (diff)
Add more tests, refactor array lengths/consteval work
Fix #2922: add unknown length as a condition for a type having unknown. Incorporate reviews: * Extract some of the const evaluation workings into functions * Add fixmes on the hacks * Add tests for impls on specific array lengths (these work!!! 😁) * Add tests for const generics (indeed we don't support it yet)
Diffstat (limited to 'crates/hir_ty/src/tests/simple.rs')
-rw-r--r--crates/hir_ty/src/tests/simple.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs
index 1032f09ac..a9cd42186 100644
--- a/crates/hir_ty/src/tests/simple.rs
+++ b/crates/hir_ty/src/tests/simple.rs
@@ -1271,12 +1271,14 @@ fn infer_array() {
1271 1271
1272 let b = [a, ["b"]]; 1272 let b = [a, ["b"]];
1273 let x: [u8; 0] = []; 1273 let x: [u8; 0] = [];
1274 // FIXME: requires const evaluation/taking type from rhs somehow
1275 let y: [u8; 2+2] = [1,2,3,4];
1274 } 1276 }
1275 "#, 1277 "#,
1276 expect![[r#" 1278 expect![[r#"
1277 8..9 'x': &str 1279 8..9 'x': &str
1278 17..18 'y': isize 1280 17..18 'y': isize
1279 27..292 '{ ... []; }': () 1281 27..395 '{ ...,4]; }': ()
1280 37..38 'a': [&str; 1] 1282 37..38 'a': [&str; 1]
1281 41..44 '[x]': [&str; 1] 1283 41..44 '[x]': [&str; 1]
1282 42..43 'x': &str 1284 42..43 'x': &str
@@ -1326,6 +1328,12 @@ fn infer_array() {
1326 259..262 '"b"': &str 1328 259..262 '"b"': &str
1327 274..275 'x': [u8; 0] 1329 274..275 'x': [u8; 0]
1328 287..289 '[]': [u8; 0] 1330 287..289 '[]': [u8; 0]
1331 368..369 'y': [u8; _]
1332 383..392 '[1,2,3,4]': [u8; 4]
1333 384..385 '1': u8
1334 386..387 '2': u8
1335 388..389 '3': u8
1336 390..391 '4': u8
1329 "#]], 1337 "#]],
1330 ); 1338 );
1331} 1339}