From 978de5cf8bfd2ff82696fc8d5369b41e147431c3 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Tue, 8 Jan 2019 16:01:19 +0100 Subject: Implement type inference for enum variants --- crates/ra_hir/src/ty/tests.rs | 16 ++++++++++++++++ crates/ra_hir/src/ty/tests/data/enum.txt | 4 ++++ 2 files changed, 20 insertions(+) create mode 100644 crates/ra_hir/src/ty/tests/data/enum.txt (limited to 'crates/ra_hir/src/ty') 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 @@ -94,6 +94,22 @@ fn test() { ); } +#[test] +fn infer_enum() { + check_inference( + r#" +enum E { + V1 { field: u32 }, + V2 +} +fn test() { + E::V1 { field: 1 }; + E::V2; +}"#, + "enum.txt", + ); +} + #[test] fn infer_refs() { check_inference( 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 @@ +[48; 82) '{ E:...:V2; }': () +[52; 70) 'E::V1 ...d: 1 }': E +[67; 68) '1': u32 +[74; 79) 'E::V2': E -- cgit v1.2.3