Compile branches in the presence of degenerate patterns

Closes #3614
This commit is contained in:
Ayaz Hafiz 2022-07-22 18:15:30 -04:00
parent f2fc6e16ec
commit 59ab1da83f
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 78 additions and 19 deletions

View file

@ -329,6 +329,24 @@ pub enum RuntimeError {
EmptySingleQuote(Region),
/// where 'aa'
MultipleCharsInSingleQuote(Region),
DegenerateBranch(Region),
}
impl RuntimeError {
pub fn runtime_message(self) -> String {
use RuntimeError::*;
match self {
DegenerateBranch(region) => {
format!(
"Hit a branch pattern that does not bind all symbols its body needs, at {:?}",
region
)
}
err => format!("{:?}", err),
}
}
}
#[derive(Clone, Copy, Debug, PartialEq)]