Move unexpected params warning to solve

This commit is contained in:
Agus Zubiaga 2024-07-06 21:36:26 -03:00
parent 63e722f61d
commit 0cbb352a89
No known key found for this signature in database
18 changed files with 115 additions and 169 deletions

View file

@ -64,7 +64,6 @@ const ABILITY_IMPLEMENTATION_NOT_IDENTIFIER: &str = "ABILITY IMPLEMENTATION NOT
const DUPLICATE_IMPLEMENTATION: &str = "DUPLICATE IMPLEMENTATION";
const UNNECESSARY_IMPLEMENTATIONS: &str = "UNNECESSARY IMPLEMENTATIONS";
const INCOMPLETE_ABILITY_IMPLEMENTATION: &str = "INCOMPLETE ABILITY IMPLEMENTATION";
const UNEXPECTED_PARAMS: &str = "UNEXPECTED PARAMS";
pub fn can_problem<'b>(
alloc: &'b RocDocAllocator<'b>,
@ -1313,20 +1312,6 @@ pub fn can_problem<'b>(
doc = report.doc;
title = report.title;
}
Problem::UnexpectedParams { module_id, region } => {
doc = alloc.stack([
alloc.reflow("This import specifies module params:"),
alloc.region(lines.convert_region(region), severity),
alloc.concat([
alloc.reflow("However, "),
alloc.module(module_id),
alloc.reflow(
" does not expect any. Did you intend to import a different module?",
),
]),
]);
title = UNEXPECTED_PARAMS.to_string();
}
};
Report {

View file

@ -247,6 +247,26 @@ pub fn type_problem<'b>(
severity,
})
}
UnexpectedImportParams(region, module_id) => {
let stack = [
alloc.reflow("This import specifies module params:"),
alloc.region(lines.convert_region(region), severity),
alloc.concat([
alloc.reflow("However, "),
alloc.module(module_id),
alloc.reflow(
" does not expect any. Did you intend to import a different module?",
),
]),
];
Some(Report {
title: "UNEXPECTED PARAMS".to_string(),
filename,
doc: alloc.stack(stack),
severity,
})
}
MissingImportParams(region, module_id, expected) => {
let stack = [
alloc.reflow("This import specifies no module params:"),