diff options
author | Florian Diebold <[email protected]> | 2019-01-19 14:48:55 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-01-19 15:02:06 +0000 |
commit | 9e4b5ecec4fa4f6a20bb4d47f09de602e9c29608 (patch) | |
tree | b94dd19bc5c2acd05b4de97e27ed4491d54cb78f /crates/ra_hir/src/ty/tests.rs | |
parent | d37bb128effd19e3aec347e3d4f2e27b5cdb9404 (diff) |
Make generics work in struct patterns
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 26 |
1 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 c590a09db..06e32df59 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -439,6 +439,32 @@ fn test(a1: A<u32>, i: i32) { | |||
439 | } | 439 | } |
440 | 440 | ||
441 | #[test] | 441 | #[test] |
442 | fn infer_generics_in_patterns() { | ||
443 | check_inference( | ||
444 | r#" | ||
445 | struct A<T> { | ||
446 | x: T, | ||
447 | } | ||
448 | |||
449 | enum Option<T> { | ||
450 | Some(T), | ||
451 | None, | ||
452 | } | ||
453 | |||
454 | fn test(a1: A<u32>, o: Option<u64>) { | ||
455 | let A { x: x2 } = a1; | ||
456 | let A::<i64> { x: x3 } = A { x: 1 }; | ||
457 | match o { | ||
458 | Option::Some(t) => t, | ||
459 | _ => 1, | ||
460 | }; | ||
461 | } | ||
462 | "#, | ||
463 | "generics_in_patterns.txt", | ||
464 | ); | ||
465 | } | ||
466 | |||
467 | #[test] | ||
442 | fn infer_function_generics() { | 468 | fn infer_function_generics() { |
443 | check_inference( | 469 | check_inference( |
444 | r#" | 470 | r#" |