Import and export improved

- Import paths are now vname and not sym
- Imports and exports accept multiple space-delimited operators in []

as a result, we can now reliably import and export the operator *

- error reporting ergonomics
This commit is contained in:
2023-08-18 21:10:29 +01:00
parent 3fdabc29da
commit 9186bce956
33 changed files with 269 additions and 228 deletions

View File

@@ -1,9 +1,7 @@
use std::rc::Rc;
use super::project_error::{ErrorPosition, ProjectError};
use super::project_error::ProjectError;
use crate::representations::location::Location;
use crate::utils::iter::box_once;
use crate::utils::BoxedIter;
use crate::{Interner, VName};
/// Multiple occurences of the same namespace with different visibility
@@ -18,13 +16,13 @@ impl ProjectError for VisibilityMismatch {
fn description(&self) -> &str {
"Some occurences of a namespace are exported but others are not"
}
fn positions(&self, i: &Interner) -> BoxedIter<ErrorPosition> {
box_once(ErrorPosition {
location: Location::File(self.file.clone()),
message: Some(format!(
"{} is opened multiple times with different visibilities",
i.extern_all(&self.namespace).join("::")
)),
})
fn message(&self, i: &Interner) -> String {
format!(
"{} is opened multiple times with different visibilities",
i.extern_all(&self.namespace).join("::")
)
}
fn one_position(&self, _i: &Interner) -> Location {
Location::File(self.file.clone())
}
}