The pipeline is finally reasonably clean

This commit is contained in:
2023-09-12 01:26:46 +01:00
parent 6693d93944
commit 8c866967a9
86 changed files with 1959 additions and 1393 deletions

View File

@@ -0,0 +1,31 @@
use itertools::Itertools;
use super::{ErrorPosition, ProjectError};
use crate::utils::BoxedIter;
use crate::{Location, VName};
/// Error raised if the same name ends up assigned to more than one thing.
/// A name in Orchid has exactly one meaning, either a value or a module.
pub struct ConflictingRoles {
/// Name assigned to multiple things
pub name: VName,
/// Location of at least two occurrences
pub locations: Vec<Location>,
}
impl ProjectError for ConflictingRoles {
fn description(&self) -> &str {
"The same name is assigned multiple times to conflicting items"
}
fn message(&self) -> String {
format!(
"{} has multiple conflicting meanings",
self.name.iter().map(|t| t.as_str()).join("::")
)
}
fn positions(&self) -> BoxedIter<ErrorPosition> {
Box::new(
(self.locations.iter())
.map(|l| ErrorPosition { location: l.clone(), message: None }),
)
}
}