diff options
author | Dawer <[email protected]> | 2021-05-10 09:22:13 +0100 |
---|---|---|
committer | Dawer <[email protected]> | 2021-05-31 20:03:47 +0100 |
commit | 49e016169fc8413e2734a655cbd55ebba2907b76 (patch) | |
tree | 7688ba28eea44454e4d541890e1d311a3a87fffb /crates/hir_ty/src/diagnostics/pattern.rs | |
parent | 9b841a9a044d9d71cece62a3e44880325bc15f78 (diff) |
Check pattern types.
Diffstat (limited to 'crates/hir_ty/src/diagnostics/pattern.rs')
-rw-r--r-- | crates/hir_ty/src/diagnostics/pattern.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/crates/hir_ty/src/diagnostics/pattern.rs b/crates/hir_ty/src/diagnostics/pattern.rs index d98fb0867..38e4b53b7 100644 --- a/crates/hir_ty/src/diagnostics/pattern.rs +++ b/crates/hir_ty/src/diagnostics/pattern.rs | |||
@@ -511,4 +511,40 @@ fn main() { | |||
511 | "#, | 511 | "#, |
512 | ); | 512 | ); |
513 | } | 513 | } |
514 | |||
515 | /// These failing tests are narrowed down from "hir_ty::diagnostics::match_check::tests" | ||
516 | // TODO fix | ||
517 | mod failing { | ||
518 | use super::*; | ||
519 | |||
520 | #[test] | ||
521 | fn never() { | ||
522 | check_diagnostics( | ||
523 | r#" | ||
524 | enum Never {} | ||
525 | |||
526 | fn enum_ref(never: &Never) { | ||
527 | match never {} | ||
528 | } | ||
529 | "#, | ||
530 | ); | ||
531 | } | ||
532 | |||
533 | #[test] | ||
534 | fn unknown_type() { | ||
535 | check_diagnostics( | ||
536 | r#" | ||
537 | enum Option<T> { Some(T), None } | ||
538 | |||
539 | fn main() { | ||
540 | // `Never` is deliberately not defined so that it's an uninferred type. | ||
541 | match Option::<Never>::None { | ||
542 | None => {} | ||
543 | Some(never) => {} | ||
544 | } | ||
545 | } | ||
546 | "#, | ||
547 | ); | ||
548 | } | ||
549 | } | ||
514 | } | 550 | } |