From 3c4a4c6ae9f62c960ba118b6e1941ba006d221d7 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 20 Jan 2019 18:08:25 +0100 Subject: Fix panic on inferring field access on an enum --- crates/ra_hir/src/ty/tests.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crates/ra_hir/src/ty/tests.rs') 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 { ); } +#[test] +fn no_panic_on_field_of_enum() { + check_inference( + r#" +enum X {} + +fn test(x: X) { + x.some_field; +} +"#, + "no_panic_on_field_of_enum.txt", + ); +} + fn infer(content: &str) -> String { let (db, _, file_id) = MockDatabase::with_single_file(content); let source_file = db.source_file(file_id); -- cgit v1.2.3