Merge pull request #3616 from rtfeldman/i3614

Compile branches in the presence of degenerate patterns
This commit is contained in:
Folkert de Vries 2022-07-25 19:45:36 +02:00 committed by GitHub
commit d212dffa1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 210 additions and 66 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)]