Report unexpected params

This commit is contained in:
Agus Zubiaga 2024-07-01 20:28:36 -03:00
parent db76ab4015
commit bc6a84a215
No known key found for this signature in database
10 changed files with 137 additions and 24 deletions

View file

@ -236,6 +236,14 @@ pub enum Problem {
one_occurrence: Region,
kind: AliasKind,
},
MissingParams {
module_id: ModuleId,
region: Region,
},
UnexpectedParams {
module_id: ModuleId,
region: Region,
},
}
impl Problem {
@ -308,6 +316,8 @@ impl Problem {
Problem::OverAppliedCrash { .. } => RuntimeError,
Problem::DefsOnlyUsedInRecursion(_, _) => Warning,
Problem::FileProblem { .. } => Fatal,
Problem::MissingParams { .. } => Warning,
Problem::UnexpectedParams { .. } => Warning,
}
}
@ -464,7 +474,9 @@ impl Problem {
| Problem::UnnecessaryOutputWildcard { region }
| Problem::OverAppliedCrash { region }
| Problem::UnappliedCrash { region }
| Problem::DefsOnlyUsedInRecursion(_, region) => Some(*region),
| Problem::DefsOnlyUsedInRecursion(_, region)
| Problem::MissingParams { region, .. }
| Problem::UnexpectedParams { region, .. } => Some(*region),
Problem::RuntimeError(RuntimeError::CircularDef(cycle_entries))
| Problem::BadRecursion(cycle_entries) => {
cycle_entries.first().map(|entry| entry.expr_region)