mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Report unfinished import as
This commit is contained in:
parent
bfb77b78cb
commit
97ed8fdbbd
2 changed files with 32 additions and 2 deletions
|
@ -4968,6 +4968,25 @@ mod test_reporting {
|
|||
"###
|
||||
);
|
||||
|
||||
test_report!(
|
||||
unfinished_import_alias,
|
||||
indoc!(
|
||||
r"
|
||||
import svg.Path as
|
||||
"
|
||||
),
|
||||
@r###"
|
||||
── UNFINISHED IMPORT in tmp/unfinished_import_alias/Test.roc ───────────────────
|
||||
|
||||
I was partway through parsing an `import`, but I got stuck here:
|
||||
|
||||
4│ import svg.Path as
|
||||
^
|
||||
|
||||
I just saw the `as` keyword, so I was expecting to see an alias next.
|
||||
"###
|
||||
);
|
||||
|
||||
test_report!(
|
||||
ingested_file_import_ann_syntax_err,
|
||||
indoc!(
|
||||
|
|
|
@ -1502,10 +1502,21 @@ fn to_import_report<'a>(
|
|||
]),
|
||||
)
|
||||
}
|
||||
IndentAlias(pos) | Alias(pos) => to_unfinished_import_report(
|
||||
alloc,
|
||||
lines,
|
||||
filename,
|
||||
*pos,
|
||||
start,
|
||||
alloc.concat([
|
||||
alloc.reflow("I just saw the "),
|
||||
alloc.keyword("as"),
|
||||
alloc.reflow(" keyword, so I was expecting to see an alias next."),
|
||||
]),
|
||||
),
|
||||
|
||||
Annotation(problem, pos) => to_type_report(alloc, lines, filename, problem, *pos),
|
||||
Space(problem, pos) => to_space_report(alloc, lines, filename, problem, *pos),
|
||||
IndentAlias(_) => todo!(),
|
||||
Alias(_) => todo!(),
|
||||
ExposingListStart(_) => todo!(),
|
||||
ExposedName(_) => todo!(),
|
||||
ExposingListEnd(_) => todo!(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue