implement optional fields in function pattern matches

This commit is contained in:
Folkert 2020-08-13 00:09:57 +02:00
parent ab78725944
commit 20ddbeb528
5 changed files with 264 additions and 52 deletions

View file

@ -409,7 +409,8 @@ fn test_at_path<'a>(selected_path: &Path, branch: &Branch<'a>, all_tests: &mut V
arguments.push((Pattern::Underscore, destruct.layout.clone()));
}
DestructType::Optional(_expr) => {
todo!("test_at_type for optional destruct");
// todo!("test_at_type for optional destruct");
arguments.push((Pattern::Underscore, destruct.layout.clone()));
}
}
}
@ -542,7 +543,8 @@ fn to_relevant_branch_help<'a>(
DestructType::Guard(guard) => guard.clone(),
DestructType::Required => Pattern::Underscore,
DestructType::Optional(_expr) => {
todo!("TODO decision tree for optional field branch");
// todo!("TODO decision tree for optional field branch");
Pattern::Underscore
}
};