Skip to content

Commit aec20e5

Browse files
committed
missing match arm add test for partially diverging type
1 parent 26e5bb0 commit aec20e5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

crates/ra_hir_ty/src/_match.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,27 @@ mod tests {
14221422

14231423
check_no_diagnostic(content);
14241424
}
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+
}
14251446
}
14261447

14271448
#[cfg(test)]

0 commit comments

Comments
 (0)