mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-05 01:20:20 +00:00
Merge remote-tracking branch 'remote/main' into builtin-task
This commit is contained in:
commit
eca453d07f
367 changed files with 14084 additions and 12080 deletions
|
@ -203,7 +203,7 @@ fn to_expr_report<'a>(
|
|||
alloc.region_with_subregion(lines.convert_region(surroundings), region, severity),
|
||||
alloc.concat([
|
||||
alloc.reflow("Looks like you are trying to define a function. "),
|
||||
alloc.reflow("In roc, functions are always written as a lambda, like "),
|
||||
alloc.reflow("In Roc, functions are always written as a lambda, like "),
|
||||
alloc.parser_suggestion("increment = \\n -> n + 1"),
|
||||
alloc.reflow("."),
|
||||
]),
|
||||
|
@ -257,7 +257,7 @@ fn to_expr_report<'a>(
|
|||
Context::InDef(_pos) => {
|
||||
vec![alloc.stack([
|
||||
alloc.reflow("Looks like you are trying to define a function. "),
|
||||
alloc.reflow("In roc, functions are always written as a lambda, like "),
|
||||
alloc.reflow("In Roc, functions are always written as a lambda, like "),
|
||||
alloc
|
||||
.parser_suggestion("increment = \\n -> n + 1")
|
||||
.indent(4),
|
||||
|
@ -509,7 +509,7 @@ fn to_expr_report<'a>(
|
|||
alloc.region_with_subregion(lines.convert_region(surroundings), region, severity),
|
||||
alloc.concat([
|
||||
alloc.reflow("Looks like you are trying to define a function. "),
|
||||
alloc.reflow("In roc, functions are always written as a lambda, like "),
|
||||
alloc.reflow("In Roc, functions are always written as a lambda, like "),
|
||||
alloc.parser_suggestion("increment = \\n -> n + 1"),
|
||||
alloc.reflow("."),
|
||||
]),
|
||||
|
@ -695,6 +695,29 @@ fn to_expr_report<'a>(
|
|||
severity,
|
||||
}
|
||||
}
|
||||
EExpr::StmtAfterExpr(pos) => {
|
||||
let surroundings = Region::new(start, *pos);
|
||||
let region = LineColumnRegion::from_pos(lines.convert_pos(*pos));
|
||||
|
||||
let doc = alloc.stack([
|
||||
alloc
|
||||
.reflow(r"I just finished parsing an expression with a series of definitions,"),
|
||||
alloc.reflow(
|
||||
r"and this line is indented as if it's intended to be part of that expression:",
|
||||
),
|
||||
alloc.region_with_subregion(lines.convert_region(surroundings), region, severity),
|
||||
alloc.concat([alloc.reflow(
|
||||
"However, I already saw the final expression in that series of definitions.",
|
||||
)]),
|
||||
]);
|
||||
|
||||
Report {
|
||||
filename,
|
||||
doc,
|
||||
title: "STATEMENT AFTER EXPRESSION".to_string(),
|
||||
severity,
|
||||
}
|
||||
}
|
||||
_ => todo!("unhandled parse error: {:?}", parse_problem),
|
||||
}
|
||||
}
|
||||
|
@ -1518,7 +1541,7 @@ fn to_import_report<'a>(
|
|||
alloc.concat([
|
||||
alloc.reflow("I was expecting to see the "),
|
||||
alloc.keyword("as"),
|
||||
alloc.reflow(" keyword, like:"),
|
||||
alloc.reflow(" keyword next, like:"),
|
||||
]),
|
||||
alloc
|
||||
.parser_suggestion("import svg.Path as SvgPath")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue