mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Check record field suffixes in annotations
This commit is contained in:
parent
12c735644f
commit
ecc5fa57dd
4 changed files with 125 additions and 4 deletions
|
@ -252,6 +252,8 @@ pub enum Problem {
|
|||
region: Region,
|
||||
},
|
||||
StmtAfterExpr(Region),
|
||||
UnsuffixedEffectfulRecordField(Region),
|
||||
SuffixedPureRecordField(Region),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -337,6 +339,9 @@ impl Problem {
|
|||
Problem::StatementsAfterReturn { .. } => Warning,
|
||||
Problem::ReturnAtEndOfFunction { .. } => Warning,
|
||||
Problem::StmtAfterExpr(_) => Fatal,
|
||||
Problem::UnsuffixedEffectfulRecordField(_) | Problem::SuffixedPureRecordField(..) => {
|
||||
Warning
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -502,11 +507,14 @@ impl Problem {
|
|||
| Problem::DefsOnlyUsedInRecursion(_, region)
|
||||
| Problem::ReturnOutsideOfFunction { region }
|
||||
| Problem::StatementsAfterReturn { region }
|
||||
| Problem::ReturnAtEndOfFunction { region } => Some(*region),
|
||||
| Problem::ReturnAtEndOfFunction { region }
|
||||
| Problem::UnsuffixedEffectfulRecordField(region)
|
||||
| Problem::SuffixedPureRecordField(region) => Some(*region),
|
||||
Problem::RuntimeError(RuntimeError::CircularDef(cycle_entries))
|
||||
| Problem::BadRecursion(cycle_entries) => {
|
||||
cycle_entries.first().map(|entry| entry.expr_region)
|
||||
}
|
||||
|
||||
Problem::StmtAfterExpr(region) => Some(*region),
|
||||
Problem::RuntimeError(RuntimeError::UnresolvedTypeVar)
|
||||
| Problem::RuntimeError(RuntimeError::ErroneousType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue