mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-31 17:17:26 +00:00
Implement most of the recent round of PR feedback
This commit is contained in:
parent
03f83a0ba8
commit
6a2ffb2f5a
13 changed files with 67 additions and 116 deletions
|
@ -248,6 +248,9 @@ pub enum Problem {
|
|||
StatementsAfterReturn {
|
||||
region: Region,
|
||||
},
|
||||
ReturnAtEndOfFunction {
|
||||
region: Region,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -331,6 +334,7 @@ impl Problem {
|
|||
Problem::FileProblem { .. } => Fatal,
|
||||
Problem::ReturnOutsideOfFunction { .. } => Warning,
|
||||
Problem::StatementsAfterReturn { .. } => Warning,
|
||||
Problem::ReturnAtEndOfFunction { .. } => Warning,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,7 +446,6 @@ impl Problem {
|
|||
field: region,
|
||||
})
|
||||
| Problem::RuntimeError(RuntimeError::ReadIngestedFileError { region, .. })
|
||||
| Problem::RuntimeError(RuntimeError::ReturnOutsideOfFunction(region))
|
||||
| Problem::InvalidAliasRigid { region, .. }
|
||||
| Problem::InvalidInterpolation(region)
|
||||
| Problem::InvalidHexadecimal(region)
|
||||
|
@ -496,7 +499,8 @@ impl Problem {
|
|||
| Problem::UnappliedDbg { region }
|
||||
| Problem::DefsOnlyUsedInRecursion(_, region)
|
||||
| Problem::ReturnOutsideOfFunction { region }
|
||||
| Problem::StatementsAfterReturn { region } => Some(*region),
|
||||
| Problem::StatementsAfterReturn { region }
|
||||
| Problem::ReturnAtEndOfFunction { region } => Some(*region),
|
||||
Problem::RuntimeError(RuntimeError::CircularDef(cycle_entries))
|
||||
| Problem::BadRecursion(cycle_entries) => {
|
||||
cycle_entries.first().map(|entry| entry.expr_region)
|
||||
|
@ -703,8 +707,6 @@ pub enum RuntimeError {
|
|||
},
|
||||
|
||||
MalformedSuffixed(Region),
|
||||
|
||||
ReturnOutsideOfFunction(Region),
|
||||
}
|
||||
|
||||
impl RuntimeError {
|
||||
|
@ -753,8 +755,7 @@ impl RuntimeError {
|
|||
record: _,
|
||||
field: region,
|
||||
}
|
||||
| RuntimeError::ReadIngestedFileError { region, .. }
|
||||
| RuntimeError::ReturnOutsideOfFunction(region) => *region,
|
||||
| RuntimeError::ReadIngestedFileError { region, .. } => *region,
|
||||
RuntimeError::InvalidUnicodeCodePt(region) => *region,
|
||||
RuntimeError::UnresolvedTypeVar | RuntimeError::ErroneousType => Region::zero(),
|
||||
RuntimeError::LookupNotInScope { loc_name, .. } => loc_name.region,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue