From 43df7c3d53198e8ae3509035eb5273d8a94f758b Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 11 Feb 2020 21:07:18 +0100 Subject: Don't let unknown match arms fall back to ! --- crates/ra_hir_ty/src/tests/never_type.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'crates/ra_hir_ty/src/tests') diff --git a/crates/ra_hir_ty/src/tests/never_type.rs b/crates/ra_hir_ty/src/tests/never_type.rs index c202f545a..a77209480 100644 --- a/crates/ra_hir_ty/src/tests/never_type.rs +++ b/crates/ra_hir_ty/src/tests/never_type.rs @@ -101,6 +101,7 @@ fn test() { ); assert_eq!(t, "Option"); } + #[test] fn never_type_can_be_reinferred3() { let t = type_at( @@ -137,6 +138,22 @@ fn test(a: Void) { assert_eq!(t, "!"); } +#[test] +fn match_unknown_arm() { + let t = type_at( + r#" +//- /main.rs +fn test(a: Option) { + let t = match 0 { + _ => unknown, + }; + t<|>; +} +"#, + ); + assert_eq!(t, "{unknown}"); +} + #[test] fn if_never() { let t = type_at( -- cgit v1.2.3