Fix two canonicalization crashes: try() and overflowed tuple indexes

This commit is contained in:
Joshua Warner 2025-01-11 13:51:30 -08:00
parent 7d464a2989
commit e0ef01fa82
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
11 changed files with 114 additions and 16 deletions

View file

@ -225,6 +225,9 @@ pub enum Problem {
OverAppliedDbg {
region: Region,
},
UnderAppliedTry {
region: Region,
},
FileProblem {
filename: PathBuf,
error: io::ErrorKind,
@ -339,6 +342,7 @@ impl Problem {
Problem::OverAppliedCrash { .. } => RuntimeError,
Problem::UnappliedDbg { .. } => RuntimeError,
Problem::OverAppliedDbg { .. } => RuntimeError,
Problem::UnderAppliedTry { .. } => Warning,
Problem::DefsOnlyUsedInRecursion(_, _) => Warning,
Problem::FileProblem { .. } => Fatal,
Problem::ReturnOutsideOfFunction { .. } => Warning,
@ -467,6 +471,7 @@ impl Problem {
| Problem::UnappliedCrash { region }
| Problem::OverAppliedDbg { region }
| Problem::UnappliedDbg { region }
| Problem::UnderAppliedTry { region }
| Problem::DefsOnlyUsedInRecursion(_, region)
| Problem::ReturnOutsideOfFunction { region, .. }
| Problem::StatementsAfterReturn { region }
@ -681,6 +686,7 @@ pub enum RuntimeError {
},
NonFunctionHostedAnnotation(Region),
InvalidTupleIndex(Region),
}
impl RuntimeError {
@ -718,6 +724,7 @@ impl RuntimeError {
| RuntimeError::InvalidFloat(_, region, _)
| RuntimeError::InvalidInt(_, _, region, _)
| RuntimeError::EmptySingleQuote(region)
| RuntimeError::InvalidTupleIndex(region)
| RuntimeError::MultipleCharsInSingleQuote(region)
| RuntimeError::DegenerateBranch(region)
| RuntimeError::InvalidInterpolation(region)