mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Report lacking platform name in app header
This commit is contained in:
parent
3332503f1d
commit
2fc8e88cca
2 changed files with 48 additions and 0 deletions
|
@ -6009,6 +6009,33 @@ In roc, functions are always written as a lambda, like{}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn provides_to_missing_platform_in_app_header() {
|
||||||
|
report_header_problem_as(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
app "broken"
|
||||||
|
provides [main] to
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
── WEIRD PROVIDES ──────────────────────────────────────── /code/proj/Main.roc ─
|
||||||
|
|
||||||
|
I am partway through parsing a header, but I got stuck here:
|
||||||
|
|
||||||
|
1│ app "broken"
|
||||||
|
2│ provides [main] to
|
||||||
|
^
|
||||||
|
|
||||||
|
I am expecting platform name, like
|
||||||
|
|
||||||
|
to pf
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn platform_requires_rigids() {
|
fn platform_requires_rigids() {
|
||||||
report_header_problem_as(
|
report_header_problem_as(
|
||||||
|
|
|
@ -3540,6 +3540,27 @@ fn to_provides_report<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EProvides::IndentListStart(pos) => {
|
||||||
|
let surroundings = Region::new(start, pos);
|
||||||
|
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
||||||
|
|
||||||
|
let doc = alloc.stack([
|
||||||
|
alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"),
|
||||||
|
alloc.region_with_subregion(lines.convert_region(surroundings), region),
|
||||||
|
alloc.reflow("I am expecting platform name, like"),
|
||||||
|
alloc
|
||||||
|
.parser_suggestion("to pf")
|
||||||
|
.indent(4),
|
||||||
|
]);
|
||||||
|
|
||||||
|
Report {
|
||||||
|
filename,
|
||||||
|
doc,
|
||||||
|
title: "WEIRD PROVIDES".to_string(),
|
||||||
|
severity: Severity::RuntimeError,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_ => todo!("unhandled parse error {:?}", parse_problem),
|
_ => todo!("unhandled parse error {:?}", parse_problem),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue