diff options
Diffstat (limited to 'crates/ra_hir_ty/src/tests/simple.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests/simple.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index de63f4cce..6d3e264af 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs | |||
@@ -325,6 +325,29 @@ fn test() { | |||
325 | } | 325 | } |
326 | 326 | ||
327 | #[test] | 327 | #[test] |
328 | fn infer_union() { | ||
329 | assert_snapshot!( | ||
330 | infer(r#" | ||
331 | union MyUnion { | ||
332 | foo: u32, | ||
333 | bar: f32, | ||
334 | } | ||
335 | |||
336 | unsafe fn baz(u: MyUnion) { | ||
337 | let inner = u.foo; | ||
338 | } | ||
339 | "#), | ||
340 | @r###" | ||
341 | 61..62 'u': MyUnion | ||
342 | 73..99 '{ ...foo; }': () | ||
343 | 83..88 'inner': u32 | ||
344 | 91..92 'u': MyUnion | ||
345 | 91..96 'u.foo': u32 | ||
346 | "### | ||
347 | ); | ||
348 | } | ||
349 | |||
350 | #[test] | ||
328 | fn infer_refs() { | 351 | fn infer_refs() { |
329 | assert_snapshot!( | 352 | assert_snapshot!( |
330 | infer(r#" | 353 | infer(r#" |