#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ElabError {
UnsupportedConstruct { hier_path: String, detail: String },
Frontend(String),
MergeInvariantViolated {
canonical_hier_path: String,
other_hier_path: String,
member_index: usize,
detail: String,
},
}
impl std::fmt::Display for ElabError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ElabError::UnsupportedConstruct { hier_path, detail } => {
write!(
f,
"unsupported construct at `{hier_path}` ({detail}) — not lowered by this elaboration pass"
)
}
ElabError::Frontend(msg) => write!(f, "sv-lang frontend error: {msg}"),
ElabError::MergeInvariantViolated {
canonical_hier_path,
other_hier_path,
member_index,
detail,
} => write!(
f,
"merge invariant violated between `{canonical_hier_path}` and \
`{other_hier_path}` at member {member_index}: {detail}"
),
}
}
}
impl std::error::Error for ElabError {}