mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Improve unhandled type syntax errors
This commit is contained in:
parent
9c742caf9b
commit
0e97bfa29f
1 changed files with 21 additions and 13 deletions
|
@ -703,8 +703,8 @@ fn to_expr_report<'a>(
|
||||||
EExpr::Return(EReturn::Space(parse_problem, pos), _) => {
|
EExpr::Return(EReturn::Space(parse_problem, pos), _) => {
|
||||||
to_space_report(alloc, lines, filename, parse_problem, *pos)
|
to_space_report(alloc, lines, filename, parse_problem, *pos)
|
||||||
}
|
}
|
||||||
// If you're adding or changing syntax, please handle the case with a good error message
|
// If you're adding or changing syntax, please handle the case with a
|
||||||
// above instead of adding more unhandled cases below.
|
// good error message above instead of adding more unhandled cases below.
|
||||||
EExpr::End(pos)
|
EExpr::End(pos)
|
||||||
| EExpr::Dot(pos)
|
| EExpr::Dot(pos)
|
||||||
| EExpr::Access(pos)
|
| EExpr::Access(pos)
|
||||||
|
@ -2256,6 +2256,8 @@ fn to_pattern_report<'a>(
|
||||||
&EPattern::NumLiteral(ENumber::End, pos) => {
|
&EPattern::NumLiteral(ENumber::End, pos) => {
|
||||||
to_malformed_number_literal_report(alloc, lines, filename, pos)
|
to_malformed_number_literal_report(alloc, lines, filename, pos)
|
||||||
}
|
}
|
||||||
|
// If you're adding or changing syntax, please handle the case with a
|
||||||
|
// good error message above instead of adding more unhandled cases below.
|
||||||
EPattern::AsKeyword(pos)
|
EPattern::AsKeyword(pos)
|
||||||
| EPattern::AsIdentifier(pos)
|
| EPattern::AsIdentifier(pos)
|
||||||
| EPattern::Underscore(pos)
|
| EPattern::Underscore(pos)
|
||||||
|
@ -2780,17 +2782,23 @@ fn to_type_report<'a>(
|
||||||
severity,
|
severity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If you're adding or changing syntax, please handle the case with a
|
||||||
EType::Space(_, _)
|
// good error message above instead of adding more unhandled cases below.
|
||||||
| EType::UnderscoreSpacing(_)
|
EType::Space(_, pos)
|
||||||
| EType::TWildcard(_)
|
| EType::UnderscoreSpacing(pos)
|
||||||
| EType::TInferred(_)
|
| EType::TWildcard(pos)
|
||||||
| EType::TEnd(_)
|
| EType::TInferred(pos)
|
||||||
| EType::TWhereBar(_)
|
| EType::TEnd(pos)
|
||||||
| EType::TImplementsClause(_)
|
| EType::TWhereBar(pos)
|
||||||
| EType::TAbilityImpl(_, _) => {
|
| EType::TImplementsClause(pos)
|
||||||
todo!("unhandled type parse error: {:?}", &parse_problem)
|
| EType::TAbilityImpl(_, pos) => to_unhandled_parse_error_report(
|
||||||
}
|
alloc,
|
||||||
|
lines,
|
||||||
|
filename,
|
||||||
|
format!("{:?}", parse_problem),
|
||||||
|
*pos,
|
||||||
|
start,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue