mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Add error message when imports
are missing
This commit is contained in:
parent
1086189d76
commit
39feabe502
2 changed files with 27 additions and 1 deletions
|
@ -3400,7 +3400,7 @@ fn to_imports_report<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
EImports::Imports(pos) => {
|
||||
EImports::Imports(pos) | EImports::IndentImports(pos) => {
|
||||
let surroundings = Region::new(start, pos);
|
||||
let region = LineColumnRegion::from_pos(lines.convert_pos(pos));
|
||||
|
||||
|
|
|
@ -6138,6 +6138,32 @@ I need all branches in an `if` to have the same type!
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_imports() {
|
||||
report_header_problem_as(
|
||||
indoc!(
|
||||
r#"
|
||||
interface Foobar
|
||||
exposes [ main, Foo ]
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
── WEIRD IMPORTS ───────────────────────────────────────────────────────────────
|
||||
|
||||
I am partway through parsing a header, but I got stuck here:
|
||||
|
||||
2│ exposes [ main, Foo ]
|
||||
^
|
||||
|
||||
I am expecting the `imports` keyword next, like
|
||||
|
||||
imports [ Animal, default, tame ]
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exposes_identifier() {
|
||||
report_header_problem_as(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue