Leftover statement warning for pure statements

This commit is contained in:
Agus Zubiaga 2024-10-15 22:33:07 -03:00
parent 6e6382ab23
commit 69e026f8bb
No known key found for this signature in database
7 changed files with 140 additions and 69 deletions

View file

@ -39,6 +39,7 @@ pub enum TypeError {
UnexpectedModuleParams(Region, ModuleId),
MissingModuleParams(Region, ModuleId, ErrorType),
ModuleParamsMismatch(Region, ModuleId, ErrorType, ErrorType),
PureStmt(Region),
}
impl TypeError {
@ -63,6 +64,7 @@ impl TypeError {
TypeError::ModuleParamsMismatch(..) => RuntimeError,
TypeError::IngestedFileBadUtf8(..) => Fatal,
TypeError::IngestedFileUnsupportedType(..) => Fatal,
TypeError::PureStmt(..) => Warning,
}
}
@ -78,7 +80,8 @@ impl TypeError {
| TypeError::BadPatternMissingAbility(region, ..)
| TypeError::UnexpectedModuleParams(region, ..)
| TypeError::MissingModuleParams(region, ..)
| TypeError::ModuleParamsMismatch(region, ..) => Some(*region),
| TypeError::ModuleParamsMismatch(region, ..)
| TypeError::PureStmt(region) => Some(*region),
TypeError::UnfulfilledAbility(ab, ..) => ab.region(),
TypeError::Exhaustive(e) => Some(e.region()),
TypeError::CircularDef(c) => c.first().map(|ce| ce.symbol_region),