aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authorMarcus Klaas de Vries <[email protected]>2019-01-15 17:47:37 +0000
committerAleksey Kladov <[email protected]>2019-01-19 12:37:25 +0000
commit5648dcd36e65dde9c8f41884eed64a7e1a1d2073 (patch)
tree677c70225c3651ba65fa439782bda8d78dc029c7 /crates/ra_hir/src/ty
parentafaa26636e4391ebacfc09e9c994c11bab58b834 (diff)
Implement type inference for tuples and refs
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/tests.rs11
-rw-r--r--crates/ra_hir/src/ty/tests/data/pattern.txt15
2 files changed, 26 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index fc1e5b09c..a55551cbb 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -362,11 +362,22 @@ fn test(x: &str, y: isize) {
362fn infer_pattern() { 362fn infer_pattern() {
363 check_inference( 363 check_inference(
364 r#" 364 r#"
365enum E { A { x: usize }, B }
366
365fn test(x: &i32) { 367fn test(x: &i32) {
366 let y = x; 368 let y = x;
367 let &z = x; 369 let &z = x;
368 let a = z; 370 let a = z;
369 let (c, d) = (1, "hello"); 371 let (c, d) = (1, "hello");
372
373 let e = E::A { x: 3 };
374 if let E::A { x: x } = e {
375 x
376 };
377 match e {
378 E::A { x } => x,
379 E::B => 1,
380 };
370} 381}
371"#, 382"#,
372 "pattern.txt", 383 "pattern.txt",
diff --git a/crates/ra_hir/src/ty/tests/data/pattern.txt b/crates/ra_hir/src/ty/tests/data/pattern.txt
new file mode 100644
index 000000000..cca521833
--- /dev/null
+++ b/crates/ra_hir/src/ty/tests/data/pattern.txt
@@ -0,0 +1,15 @@
1[9; 10) 'x': &i32
2[18; 98) '{ ...o"); }': ()
3[28; 29) 'y': &i32
4[32; 33) 'x': &i32
5[43; 45) '&z': &i32
6[44; 45) 'z': i32
7[48; 49) 'x': &i32
8[59; 60) 'a': i32
9[63; 64) 'z': i32
10[74; 80) '(c, d)': (i32, &str)
11[75; 76) 'c': i32
12[78; 79) 'd': &str
13[83; 95) '(1, "hello")': (i32, &str)
14[84; 85) '1': i32
15[87; 94) '"hello"': &str