nar/syntax/abs/desugar/
error.rs1use std::fmt::{Display, Error as FmtError, Formatter};
2
3use voile_util::loc::Ident;
4
5#[derive(Debug, Clone)]
6pub enum DesugarErr {
7 UnresolvedReference(Ident),
8
9 NotDefn(Ident),
11 NotCons(Ident),
12}
13
14impl Display for DesugarErr {
15 fn fmt(&self, f: &mut Formatter) -> Result<(), FmtError> {
16 use DesugarErr::*;
17 match self {
18 UnresolvedReference(i) => write!(f, "Unresolved reference: `{}` at {}.", i.text, i.loc),
19 NotDefn(i) => write!(f, "`{}` is not a definition (at {}).", i.text, i.loc),
20 NotCons(i) => write!(f, "`{}` is not a constructor (at {}).", i.text, i.loc),
21 }
22 }
23}