diff options
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 06e32df59..5aa24a29b 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -507,6 +507,20 @@ fn test() -> i128 { | |||
507 | ); | 507 | ); |
508 | } | 508 | } |
509 | 509 | ||
510 | #[test] | ||
511 | fn no_panic_on_field_of_enum() { | ||
512 | check_inference( | ||
513 | r#" | ||
514 | enum X {} | ||
515 | |||
516 | fn test(x: X) { | ||
517 | x.some_field; | ||
518 | } | ||
519 | "#, | ||
520 | "no_panic_on_field_of_enum.txt", | ||
521 | ); | ||
522 | } | ||
523 | |||
510 | fn infer(content: &str) -> String { | 524 | fn infer(content: &str) -> String { |
511 | let (db, _, file_id) = MockDatabase::with_single_file(content); | 525 | let (db, _, file_id) = MockDatabase::with_single_file(content); |
512 | let source_file = db.source_file(file_id); | 526 | let source_file = db.source_file(file_id); |