mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Allow unsuffixed statements in parser
Moves the "STATEMENT AFTER EXPRESSION" error from the parser to canonicalization. We'll later use this to allow this case in effectful functions.
This commit is contained in:
parent
f677592f97
commit
2cce5ad023
23 changed files with 280 additions and 107 deletions
|
@ -251,6 +251,7 @@ pub enum Problem {
|
|||
ReturnAtEndOfFunction {
|
||||
region: Region,
|
||||
},
|
||||
StmtAfterExpr(Region),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -335,6 +336,7 @@ impl Problem {
|
|||
Problem::ReturnOutsideOfFunction { .. } => Warning,
|
||||
Problem::StatementsAfterReturn { .. } => Warning,
|
||||
Problem::ReturnAtEndOfFunction { .. } => Warning,
|
||||
Problem::StmtAfterExpr(_) => Fatal,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -505,6 +507,7 @@ impl Problem {
|
|||
| 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)
|
||||
| Problem::RuntimeError(RuntimeError::NonExhaustivePattern)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue