Report non-exhaustive patterns with guards

This commit is contained in:
ayazhafiz 2022-02-27 18:50:47 -05:00
parent 32ef4a5566
commit 81481e2599
4 changed files with 43 additions and 2 deletions

View file

@ -160,7 +160,15 @@ fn pattern_to_doc_help<'b>(
},
Ctor(union, tag_id, args) => {
match union.render_as {
RenderAs::Guard => panic!("can this happen? inform Folkert"),
RenderAs::Guard => {
// #Guard <fake-condition-tag> <unexhausted-pattern>
debug_assert_eq!(
union.alternatives[tag_id.0 as usize].name,
TagName::Global("#Guard".into())
);
debug_assert!(args.len() == 2);
pattern_to_doc_help(alloc, args[1].clone(), in_type_param)
}
RenderAs::Record(field_names) => {
let mut arg_docs = Vec::with_capacity(args.len());