Give an error instead of panicking on an empty tuple type

This commit is contained in:
Joshua Warner 2024-12-08 10:11:15 -08:00
parent 861f9c5d47
commit cbd6d50584
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
5 changed files with 35 additions and 25 deletions

View file

@ -255,6 +255,7 @@ pub enum Problem {
StmtAfterExpr(Region),
UnsuffixedEffectfulRecordField(Region),
SuffixedPureRecordField(Region),
EmptyTupleType(Region),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -343,6 +344,7 @@ impl Problem {
Problem::UnsuffixedEffectfulRecordField(_) | Problem::SuffixedPureRecordField(..) => {
Warning
}
Problem::EmptyTupleType(_) => Warning,
}
}
@ -455,6 +457,7 @@ impl Problem {
| Problem::RuntimeError(RuntimeError::ReadIngestedFileError { region, .. })
| Problem::InvalidAliasRigid { region, .. }
| Problem::InvalidInterpolation(region)
| Problem::EmptyTupleType(region)
| Problem::InvalidHexadecimal(region)
| Problem::InvalidUnicodeCodePt(region)
| Problem::NestedDatatype {
@ -791,4 +794,5 @@ pub enum MalformedPatternProblem {
EmptySingleQuote,
MultipleCharsInSingleQuote,
DuplicateListRestPattern,
CantApplyPattern,
}