cl-parser: Dedicated parsing logic for patterns!

This commit is contained in:
2025-05-18 04:00:00 -04:00
parent e6156343c3
commit 3e2063835b
11 changed files with 100 additions and 4 deletions

View File

@@ -519,6 +519,11 @@ impl<'a> Inference<'a> for Pattern {
e.at = node;
Ok(node)
}
Pattern::Path(path) => {
// Evaluating a path pattern puts type constraints on the scrutinee
path.evaluate(e.table, e.at)
.map_err(|_| InferenceError::NotFound(path.clone()))
}
Pattern::Literal(literal) => literal.infer(e),
Pattern::Rest(Some(pat)) => pat.infer(e), // <-- glaring soundness holes
Pattern::Rest(_) => todo!("Fix glaring soundness holes in pattern"),