From aec20e50946ea427ceb6a44451459f0cb3a84a4f Mon Sep 17 00:00:00 2001 From: Josh Mcguigan Date: Sat, 11 Apr 2020 07:13:47 -0700 Subject: missing match arm add test for partially diverging type --- crates/ra_hir_ty/src/_match.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'crates/ra_hir_ty/src') diff --git a/crates/ra_hir_ty/src/_match.rs b/crates/ra_hir_ty/src/_match.rs index 4be08e9a3..596194dcf 100644 --- a/crates/ra_hir_ty/src/_match.rs +++ b/crates/ra_hir_ty/src/_match.rs @@ -1422,6 +1422,27 @@ mod tests { check_no_diagnostic(content); } + + #[test] + fn expr_partially_diverges() { + let content = r" + enum Either { + A(T), + B, + } + fn foo() -> Either { + Either::B + } + fn test_fn() -> u32 { + match foo() { + Either::A(val) => val, + Either::B => 0, + } + } + "; + + check_no_diagnostic(content); + } } #[cfg(test)] -- cgit v1.2.3