Limit re-exporting of types

- Only allow one module re-export per file
- Warn when a re-exported type clashes with a locally exported type, and prioritize the local type.
This commit is contained in:
Simon Hausmann 2022-12-05 16:11:39 +01:00 committed by Simon Hausmann
parent 8faf57fa40
commit 554d153e35
3 changed files with 31 additions and 18 deletions

View file

@ -2214,8 +2214,11 @@ impl Exports {
for export in other_exports {
match self.0.binary_search_by(|entry| entry.0.cmp(&export.0)) {
Ok(_) => {
diag.push_error(
format!("re-export '{}' is already exported in this file", &*export.0),
diag.push_warning(
format!(
"'{}' is already exported in this file; it will not be re-exported",
&*export.0
),
&export.0.name_ident,
);
}