ast: pub patterns, and, since Pat replaced Ty, !(never) patterns.

This commit is contained in:
2025-10-21 07:42:04 -04:00
parent ccb6bef6d9
commit c7e2e3d31d
3 changed files with 11 additions and 1 deletions

View File

@@ -180,6 +180,8 @@ impl<A: Annotation> Match<A> for Pat {
(Pat::MetId(name), _) => sub.add_pat(name.clone(), expr),
(Pat::Ignore, Pat::Ignore) => true,
(Pat::Ignore, _) => false,
(Pat::Never, Pat::Never) => true,
(Pat::Never, _) => false,
(Pat::Name(pat), Pat::Name(expr)) => pat == expr,
(Pat::Name(_), _) => false,
(Pat::Path(_), Pat::Path(_)) => true,
@@ -197,7 +199,7 @@ impl<A: Annotation> Match<A> for Pat {
fn apply(&mut self, sub: &Subst<A>) {
match self {
Pat::Ignore | Pat::Name(_) | Pat::Path(_) | Pat::Lit(_) => {}
Pat::Ignore | Pat::Never | Pat::Name(_) | Pat::Path(_) | Pat::Lit(_) => {}
Pat::MetId(id) => {
if let Some(expr) = sub.pat.get(id) {
*self = expr.clone()