aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index d0da34677..642259225 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -741,6 +741,41 @@ fn test() {
741} 741}
742 742
743#[test] 743#[test]
744fn infer_type_alias() {
745 check_inference(
746 "infer_type_alias",
747 r#"
748struct A<X, Y> { x: X, y: Y };
749type Foo = A<u32, i128>;
750type Bar<T> = A<T, u128>;
751type Baz<U, V> = A<V, U>;
752fn test(x: Foo, y: Bar<&str>, z: Baz<i8, u8>) {
753 x.x;
754 x.y;
755 y.x;
756 y.y;
757 z.x;
758 z.y;
759}
760"#,
761 )
762}
763
764#[test]
765#[should_panic] // we currently can't handle this
766fn recursive_type_alias() {
767 check_inference(
768 "recursive_type_alias",
769 r#"
770struct A<X> {};
771type Foo = Foo;
772type Bar = A<Bar>;
773fn test(x: Foo) {}
774"#,
775 )
776}
777
778#[test]
744fn no_panic_on_field_of_enum() { 779fn no_panic_on_field_of_enum() {
745 check_inference( 780 check_inference(
746 "no_panic_on_field_of_enum", 781 "no_panic_on_field_of_enum",