diff options
Diffstat (limited to 'crates/hir_ty/src/tests/simple.rs')
-rw-r--r-- | crates/hir_ty/src/tests/simple.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs index 361cd6302..84c5c05fd 100644 --- a/crates/hir_ty/src/tests/simple.rs +++ b/crates/hir_ty/src/tests/simple.rs | |||
@@ -2564,3 +2564,36 @@ fn f() { | |||
2564 | "#, | 2564 | "#, |
2565 | ) | 2565 | ) |
2566 | } | 2566 | } |
2567 | |||
2568 | #[test] | ||
2569 | fn infer_type_alias_variant() { | ||
2570 | check_infer( | ||
2571 | r#" | ||
2572 | type Qux = Foo; | ||
2573 | enum Foo { | ||
2574 | Bar(i32), | ||
2575 | Baz { baz: f32 } | ||
2576 | } | ||
2577 | |||
2578 | fn f() { | ||
2579 | match Foo::Bar(3) { | ||
2580 | Qux::Bar(bar) => (), | ||
2581 | Qux::Baz { baz } => (), | ||
2582 | } | ||
2583 | } | ||
2584 | "#, | ||
2585 | expect![[r#" | ||
2586 | 72..166 '{ ... } }': () | ||
2587 | 78..164 'match ... }': () | ||
2588 | 84..92 'Foo::Bar': Bar(i32) -> Foo | ||
2589 | 84..95 'Foo::Bar(3)': Foo | ||
2590 | 93..94 '3': i32 | ||
2591 | 106..119 'Qux::Bar(bar)': Foo | ||
2592 | 115..118 'bar': i32 | ||
2593 | 123..125 '()': () | ||
2594 | 135..151 'Qux::B... baz }': Foo | ||
2595 | 146..149 'baz': f32 | ||
2596 | 155..157 '()': () | ||
2597 | "#]], | ||
2598 | ) | ||
2599 | } | ||