aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
authorJosh Mcguigan <[email protected]>2020-04-11 15:13:47 +0100
committerJosh Mcguigan <[email protected]>2020-04-11 15:13:47 +0100
commitaec20e50946ea427ceb6a44451459f0cb3a84a4f (patch)
tree599bd0c7ad86693471402514a6344fe06acd8d88 /crates/ra_hir_ty
parent26e5bb0a4efbe894d33cde3c1bc3f712fcf33cde (diff)
missing match arm add test for partially diverging type
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/_match.rs21
1 files changed, 21 insertions, 0 deletions
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 {
1422 1422
1423 check_no_diagnostic(content); 1423 check_no_diagnostic(content);
1424 } 1424 }
1425
1426 #[test]
1427 fn expr_partially_diverges() {
1428 let content = r"
1429 enum Either<T> {
1430 A(T),
1431 B,
1432 }
1433 fn foo() -> Either<!> {
1434 Either::B
1435 }
1436 fn test_fn() -> u32 {
1437 match foo() {
1438 Either::A(val) => val,
1439 Either::B => 0,
1440 }
1441 }
1442 ";
1443
1444 check_no_diagnostic(content);
1445 }
1425} 1446}
1426 1447
1427#[cfg(test)] 1448#[cfg(test)]