doughlang: enums, ref patterns, ref types

This commit is contained in:
2025-10-16 06:53:09 -04:00
parent 6da201f52f
commit e1419fa430
5 changed files with 79 additions and 26 deletions

View File

@@ -162,14 +162,14 @@ impl<A: Annotation> Match<A> for Mod<A> {
}
}
impl<A: Annotation> Match<A> for Struct {
impl<A: Annotation> Match<A> for Typedef {
fn recurse(sub: &mut Subst<A>, pat: &Self, expr: &Self) -> bool {
let (Self(pat_pat), Self(expr_pat)) = (pat, expr);
Match::recurse(sub, pat_pat, expr_pat)
let (Self(pat_kind, pat_pat), Self(expr_kind, expr_pat)) = (pat, expr);
pat_kind == expr_kind && Match::recurse(sub, pat_pat, expr_pat)
}
fn apply(&mut self, sub: &Subst<A>) {
let Self(pat) = self;
let Self(_, pat) = self;
pat.apply(sub);
}
}