Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
of memory on larger devices.
- Optimizations to reference matching, which should greatly speed up semantic
analysis speed of larger devices.
- Corrected range of error reporting of unknown templates

## 0.9.13
- Corrected the name of "explicit\_param\_decls" provisional. Note that it still
Expand Down
49 changes: 38 additions & 11 deletions src/analysis/templating/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,20 +580,47 @@ pub fn rank_templates_aux<'t>(mut templates: HashMap<&'t str,
severity: Some(DiagnosticSeverity::ERROR),
});
},
inf => {
InferiorVariant::Is(inf) => {
if !BUILTIN_TEMPLATES.iter().any(
|name|name==missing_template_name) {
report.push(
DMLError {
span: *inf.span(),
description: format!(
"No template; '{}'",
missing_template_name),
related: vec![],
severity: Some(DiagnosticSeverity::ERROR),
});
// The 'is' may contain more names than we
// are looking for, find the particular name
// that matches and use that span
// Because the same name could be used multiple
// times, but this only causes inferior binding
// report one error per such span

let spans: Vec<_> = inf.obj.names.iter()
.filter(|dmlname|
&dmlname.val == missing_template_name)
.map(|dmlname|dmlname.span())
.collect();
if spans.is_empty() {
internal_error!("Unexpectedly no name \
matching missing template \
in {:?} (wanted {})",
inf, missing_template_name);
continue;
}
for span in spans {
report.push(
DMLError {
span: *span,
description: format!(
"No template; '{}'",
missing_template_name),
related: vec![],
severity: Some(
DiagnosticSeverity::ERROR),
});
}
}
}
},
inf => {
internal_error!(
"Unexpected template dependency through {:?}",
inf);
},
}
debug!("Added dummy missing template {}",
missing_template_name);
Expand Down