diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 16 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/tests/data/enum.txt | 4 |
2 files changed, 20 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index ba2a44474..d8c0af326 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -95,6 +95,22 @@ fn test() { | |||
95 | } | 95 | } |
96 | 96 | ||
97 | #[test] | 97 | #[test] |
98 | fn infer_enum() { | ||
99 | check_inference( | ||
100 | r#" | ||
101 | enum E { | ||
102 | V1 { field: u32 }, | ||
103 | V2 | ||
104 | } | ||
105 | fn test() { | ||
106 | E::V1 { field: 1 }; | ||
107 | E::V2; | ||
108 | }"#, | ||
109 | "enum.txt", | ||
110 | ); | ||
111 | } | ||
112 | |||
113 | #[test] | ||
98 | fn infer_refs() { | 114 | fn infer_refs() { |
99 | check_inference( | 115 | check_inference( |
100 | r#" | 116 | r#" |
diff --git a/crates/ra_hir/src/ty/tests/data/enum.txt b/crates/ra_hir/src/ty/tests/data/enum.txt new file mode 100644 index 000000000..481eb0bc7 --- /dev/null +++ b/crates/ra_hir/src/ty/tests/data/enum.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | [48; 82) '{ E:...:V2; }': () | ||
2 | [52; 70) 'E::V1 ...d: 1 }': E | ||
3 | [67; 68) '1': u32 | ||
4 | [74; 79) 'E::V2': E | ||