diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 203f1fe4d..1eca68dc5 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -507,6 +507,38 @@ fn test() { | |||
507 | } | 507 | } |
508 | 508 | ||
509 | #[test] | 509 | #[test] |
510 | fn infer_impl_generics() { | ||
511 | check_inference( | ||
512 | "infer_impl_generics", | ||
513 | r#" | ||
514 | struct A<T1, T2> { | ||
515 | x: T1, | ||
516 | y: T2, | ||
517 | } | ||
518 | impl<Y, X> A<X, Y> { | ||
519 | fn x(self) -> X { | ||
520 | self.x | ||
521 | } | ||
522 | fn y(self) -> Y { | ||
523 | self.y | ||
524 | } | ||
525 | fn z<T>(self, t: T) -> (X, Y, T) { | ||
526 | (self.x, self.y, t) | ||
527 | } | ||
528 | } | ||
529 | |||
530 | fn test() -> i128 { | ||
531 | let a = A { x: 1u64, y: 1i64 }; | ||
532 | a.x(); | ||
533 | a.y(); | ||
534 | a.z(1i128); | ||
535 | a.z::<u128>(1); | ||
536 | } | ||
537 | "#, | ||
538 | ); | ||
539 | } | ||
540 | |||
541 | #[test] | ||
510 | fn infer_generic_chain() { | 542 | fn infer_generic_chain() { |
511 | check_inference( | 543 | check_inference( |
512 | "infer_generic_chain", | 544 | "infer_generic_chain", |