Report missing params

This commit is contained in:
Agus Zubiaga 2024-07-02 02:59:39 -03:00
parent bc6a84a215
commit 922b1c44ef
No known key found for this signature in database
16 changed files with 286 additions and 93 deletions

View file

@ -1313,7 +1313,6 @@ pub fn can_problem<'b>(
doc = report.doc;
title = report.title;
}
Problem::MissingParams { .. } => todo!("agus"),
Problem::UnexpectedParams { module_id, region } => {
doc = alloc.stack([
alloc.reflow("This import specifies module params:"),

View file

@ -247,6 +247,32 @@ pub fn type_problem<'b>(
severity,
})
}
MissingImportParams {
module_id,
region,
expected,
} => {
let stack = [
alloc.reflow("This import specifies no module params:"),
alloc.region(lines.convert_region(region), severity),
alloc.concat([
alloc.reflow("However, "),
alloc.module(module_id),
alloc.reflow(" expects the following to be provided:"),
]),
alloc.type_block(error_type_to_doc(alloc, expected)),
alloc.reflow("You can provide params after the module name, like:"),
alloc
.parser_suggestion("import Menu { echo, read }")
.indent(4),
];
Some(Report {
title: "MISSING PARAMS".to_string(),
filename,
doc: alloc.stack(stack),
severity,
})
}
}
}