mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Report ingested file name syntax error
This commit is contained in:
parent
755e16cb10
commit
27a9f6051e
2 changed files with 34 additions and 2 deletions
|
@ -5044,6 +5044,27 @@ mod test_reporting {
|
||||||
import Svg exposing [Path, arc, rx]
|
import Svg exposing [Path, arc, rx]
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
|
test_report!(
|
||||||
|
unfinished_ingested_file_name,
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
import "example.json" as
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
@r###"
|
||||||
|
── UNFINISHED IMPORT in tmp/unfinished_ingested_file_name/Test.roc ─────────────
|
||||||
|
|
||||||
|
I was partway through parsing an `import`, but I got stuck here:
|
||||||
|
|
||||||
|
4│ import "example.json" as
|
||||||
|
^
|
||||||
|
|
||||||
|
I was expecting to see a name next, like:
|
||||||
|
|
||||||
|
import "users.json" as users : Str
|
||||||
|
"###
|
||||||
|
);
|
||||||
|
|
||||||
test_report!(
|
test_report!(
|
||||||
ingested_file_import_ann_syntax_err,
|
ingested_file_import_ann_syntax_err,
|
||||||
indoc!(
|
indoc!(
|
||||||
|
|
|
@ -1566,8 +1566,19 @@ fn to_import_report<'a>(
|
||||||
severity: Severity::RuntimeError,
|
severity: Severity::RuntimeError,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IndentIngestedName(_) => todo!(),
|
IndentIngestedName(pos) | IngestedName(pos) => to_unfinished_import_report(
|
||||||
IngestedName(_) => todo!(),
|
alloc,
|
||||||
|
lines,
|
||||||
|
filename,
|
||||||
|
*pos,
|
||||||
|
start,
|
||||||
|
alloc.stack([
|
||||||
|
alloc.reflow("I was expecting to see a name next, like:"),
|
||||||
|
alloc
|
||||||
|
.parser_suggestion("import \"users.json\" as users : Str")
|
||||||
|
.indent(4),
|
||||||
|
]),
|
||||||
|
),
|
||||||
IndentAnnotation(_) => todo!(),
|
IndentAnnotation(_) => todo!(),
|
||||||
Annotation(problem, pos) => to_type_report(alloc, lines, filename, problem, *pos),
|
Annotation(problem, pos) => to_type_report(alloc, lines, filename, problem, *pos),
|
||||||
IndentColon(_) => todo!(),
|
IndentColon(_) => todo!(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue